Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do I get this text to align to the bottom of my div tag?

Featured Replies

This is the CSS I have for my div tag:

#footer	{
	width: 100%;
	height: 30px;
	text-align: right;
	background-image: url(images/footerbackground.fw.png);
	vertical-align: text-bottom;
}

But it's still displaying the text at the top of the div tag, rather than at the bottom of the div tag. How can I correct this?

 

Thank you for any help.

you will need to make another class so it would look like this

<div id="footer">
    <div class="bottom-align">Your text here</div>
</div>


then for your css

#footer	{
    width: 100%;
    height: 30px;
    text-align: right;
    background-image: url(images/footerbackground.fw.png);
    position: relative;
}
#footer .bottom-allign {
    position:absolute;
    bottom:0;
}

Edited by D4Y0

Spelling error, should be ".bottom-align". :p

 

Huh? there's nothing wrong with the code DY40 wrote.

 

bottom: 0 will position the very bottom of the child (absolutely positioned) element at the very bottom of it's parent (relativley positioned element)

 

as opposed to top:0 which will have exactly the opposite results..

Huh? there's nothing wrong with the code DY40 wrote.

 

bottom: 0 will position the very bottom of the child (absolutely positioned) element at the very bottom of it's parent (relativley positioned element)

 

as opposed to top:0 which will have exactly the opposite results..

 

I said it was a spelling mistake. Unless we now suddenly spell 'align' with two L's. Look again.

Alternatively, you could use:

 

#footer { display:table-cell; vertical-align:bottom; }

But display:table-cell; isn't supported by IE 7.

Edited by Lyndsey

I said it was a spelling mistake. Unless we now suddenly spell 'align' with two L's. Look again.

 

Yep, you're right, Not quite sure how I missed that :unknw:

Edited by rbrtsmith

  • Author

 

you will need to make another class so it would look like this

 

<div id="footer">
    <div class="bottom-align">Your text here</div>
</div>

 

then for your css

#footer	{
    width: 100%;
    height: 30px;
    text-align: right;
    background-image: url(images/footerbackground.fw.png);
    position: relative;
}
#footer .bottom-allign {
    position:absolute;
    bottom:0;
}

Thank you for your help, that's aligned the text to the bottom of the div tag. But it isn't aligning the text to the right anymore.

 

This is my CSS now I've altered it:

#footer	{
	width: 100%;
	height: 30px;
	text-align: right;
	background-image: url(images/footerbackground.fw.png);
	position: relative;
}

#footer .bottom-align	{
	position: absolute;
	bottom: 0;
}

This is the HTML code I've used:

<div id="footer"><div class="bottom-align"><a href="contactus.html">Contact Us</a> | <a href="copyright.html">Copyright</a> | <a href="feedback.html">Feedback</a> | <a href="brokenlink.html">Report a broken link</a></div></div>

I've tried changing the CSS to this:

#footer	{
	width: 100%;
	height: 30px;
	text-align: right;
	background-image: url(images/footerbackground.fw.png);
	position: relative;
}

#footer .bottom-align	{
	position: absolute;
	bottom: 0;
        text-align: right;
}

But I'm still having the same problem. How can I fix this?

 

Thank you for any help.

But it isn't aligning the text to the right anymore.

--------------------------------------------------------------

To achive this you can add

 right:0;

to #footer .bottom-align

  • Author

But it isn't aligning the text to the right anymore.

--------------------------------------------------------------

To achive this you can add

 right:0;

to #footer .bottom-align

Thank you for your help, that worked.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.