http://prntscr.com/2l3gnh - My Problem

I'm currently using this HTML:

<footer>
    <p class="alignleft">Text on the left.</p>
    <p class="alignright">Text on the right.</p>
</footer>

With this CSS:

/***** Reset *****/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/***** Styles *****/
html { width: 100%; -webkit-font-smoothing: antialiased; }
body { width: 100%; padding: 0; margin: 0; background: #000; text-align: center; }

p { font-size: 1.5em; line-height: 1.35em; color: #fff; padding: 0; margin: 60px 0 40px; font-family: 'helvetica neue', helvetica, arial, sans-serif; font-weight: 200; }
p strong { font-weight: 500; }

a { color: #ffcc00; text-decoration: none; }
a:hover { color: #fff; -webkit-transition:all 0.2s ease-in-out; }

ul { display: block; }
ul li { display: inline-block; margin: 0 10px; }
ul li a { opacity: 0.5; }
ul li a:hover { opacity: 1; -webkit-transition:all 0.2s ease-in-out; }

ul li.twitter a { width: 57px; height: 57px; display: block; background: transparent url('') top center no-repeat; text-indent: -9999px; }
ul li.tumblr a { width: 57px; height: 57px; display: block; background: transparent url('') top center no-repeat; text-indent: -9999px; }
ul li.youtube a { width: 57px; height: 57px; display: block; background: transparent url('') top center no-repeat; text-indent: -9999px; }
ul li.email a { width: 57px; height: 57px; display: block; background: transparent url('') top center no-repeat; text-indent: -9999px; }

.logo h1 a { width: 60px; height: 79px; display: block; background: url('') top center no-repeat; text-indent: -9999px; padding: 0; margin: 0 auto; border: none; text-align: center; }
.logo h1 a:hover { -webkit-transform:rotate(360deg); -moz-transform:rotate(360deg); -o-transform:rotate(360deg); }
.content { max-width: 480px; padding: 0 20px; display: block; margin: 15% auto 0; }

.vegas-loading { display: none; }
.vegas-overlay { background: transparent url(''); opacity: 0.5; z-index: -1; }
.vegas-background { image-rendering: optimizeQuality; -ms-interpolation-mode: bicubic; z-index: -2; }

.alignleft {
    float: left;
}
.alignright {
    float: right;
}

I want the text to be at the very bottom... like a footer. I want to keep my left and right aligned text too. Any help?

Dani AI

Generated

Classic "sticky footer" case — already flagged the right idea and 's mobile caution is important. A simple, robust pattern is to make the page a column flex container so the main area grows and the footer is pushed to the bottom when content is short. That also removes the need for float-based left/right positioning inside the footer and avoids fragile margin hacks.

A minimal structure and styles that work well:

<body>
  <div class="site">
    <main class="site-main">
      <!-- main content -->
    </main>

    <footer class="site-footer">
      <div class="left">Text on the left.</div>
      <div class="right">Text on the right.</div>
    </footer>
  </div>
</body>
html, body { height: 100%; margin: 0; }
body { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; } /* consumes remaining space, pushes footer down */
.site-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px; background: #000; color: #fff; }

Practical notes and troubleshooting: remove any large top-margin vertical centering (for example the .content { margin-top: 15% } approach) so flexbox can manage vertical space. If the existing float classes (.alignleft/.alignright) must be kept, contain them with a clearfix or set the footer to overflow: auto so its height is calculated correctly. Avoid position: fixed on mobile unless a permanently visible footer is desired — fixed footers can clash with address-bar/keyboard behavior; when fixed is used, add bottom padding to main equal to the footer height. For notch devices, add padding-bottom: env(safe-area-inset-bottom) to the footer. Flexbox is the simplest, most maintainable solution across modern browsers and removes many platform-specific quirks compared with older "push" techniques.

Recommended Answers

All 2 Replies

this is pretty common. It sounds like you want to "push" the footer down to the very bottom of the page even when you dont have enough content on the page to push it down on its own. This is sometimes known as a "sticky" footer.

Its quite easy to do and there are a few variations out there on how to implement. Here is an example you can follow and adapt to your site: Pushing a Footer to the Bottom of a Web Page

My suggestion is start with the template, then add your content in. If you start with your existing page and you try to mimic the "sticky" footer example, it may be more challenging to get it right, at least that is what I have experienced in other similar threads where someone has tried to implement it.

Member Avatar for Member #120589

Great advice as usual ^^.

I'd just add - sticky footers can be really tricky to get right on mobile devices. Test your styles in mobile browsers to see if the sticky footer stays put - or does it jump up and down as you scroll? If it does, you may need to modify the styling or even use a media query to provide a different solution for mobile.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.