Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > CSS
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 11-03-2009, 01:04 PM
  #1
tehhparadox
Novice (Level 1)
 
Join Date: Nov 2009
Posts: 8
iTrader: (0)
tehhparadox is an unknown quantity at this point
CSS styling - To the bottom?

hi guys

I'm just posting a new thread to ask if there is a way to make a div tag stick to the bottom.

this code worked at the start:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<style>
.content1 {
	border: 1px solid #CCC;
	width: 44%;
	margin-left: 10px;
	float: left;
	padding: 10px;
}

.tail {
	position: absolute;
	text-align: center;
	width: 99%;
	height: 20px;
	padding: 5px;
	background: rgb(230, 230, 230);
	bottom: 0%;
}
</style>
<body>
<div class="content1">
  <p>This is div tag class content1</p>
  <p>&nbsp;</p>
</div>
<div class="tail">
this is the div tag class is tail
</div>

</body>
</html>
The bottom: 0%; bit made the tail div tag stick to the bottom no matter what the screen res. But as this site is dynamic, the content1 tag changes and it may get longer than a page. If so, the tail div does not stick to the bottom.

This is an example of that:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<style>
.content1 {
	border: 1px solid #CCC;
	width: 44%;
	margin-left: 10px;
	float: left;
	padding: 10px;
}

.tail {
	position: absolute;
	text-align: center;
	width: 99%;
	height: 20px;
	padding: 5px;
	background: rgb(230, 230, 230);
	bottom: 0%;
}
</style>
<body>
<div class="content1">
  <p>This is div tag class content1</p>
  <p>askldjfas
    alksdjfsa
    a;sikjfd
    a;lksjdf
    ;akjsdf </p>
  <p>a;dskjf</p>
  <p>as;kdfj</p>
  <p>aklsjdf</p>
  <p>sadklfj</p>
  <p>as;ldfj</p>
  <p>'alksjfd</p>
  <p>fds</p>
  <p>&nbsp;</p>
  <p>a;lksdjf</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>a'kajfd</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>a;skdjf</p>
  <p>&nbsp;</p>
  <p>a\s;dkflj</p>
  <p>a'lksfd</p>
</div>
<div class="tail">
this is the div tag class is tail
</div>

</body>
</html>
What CSS would I use to make the tail div tag stick to the bottom of the page no matter what the screen size or browser?

Help would be very much appreciated
tehhparadox is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-03-2009, 03:13 PM
  #2
Pegasus
Extremely Flighty Admin
 
Pegasus's Avatar
 
Join Date: Nov 2001
Location: 35º South of Santa Claus
Posts: 21,472
iTrader: (0)
Pegasus is a name known to allPegasus is a name known to allPegasus is a name known to allPegasus is a name known to allPegasus is a name known to allPegasus is a name known to all
Try using margin-bottom: 0px; rather than bottom: 0%;
__________________


Decaf is the root of all evil...
HTMLForums Awards 2008
Pegasus is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-03-2009, 03:23 PM
  #3
tehhparadox
Novice (Level 1)
 
Join Date: Nov 2009
Posts: 8
iTrader: (0)
tehhparadox is an unknown quantity at this point
Thanks for the reply but that doesn't work either. The tail div tag is still above the content div tag when it is supposed to be at the bottom.
tehhparadox is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-03-2009, 06:18 PM
  #4
Excavator
Lord (Level 16)
 
Join Date: Dec 2006
Location: Alaska
Posts: 737
iTrader: (0)
Excavator is on a distinguished road
Hello tehhparadox,
The problem with ap your div at bottom:0;, as you've already seen, it's bottom of the first screen it sees. If you scroll content, the div is still stuck at the bottom:0; it started at.

Here is a full height solution that is pretty easy and very stable/cross browser compliant - http://nopeople.com/CSS/full-height-layout/index.html
__________________
Validate often, DURING development! Use it like a splelcheker.
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-04-2009, 12:38 PM
  #5
tehhparadox
Novice (Level 1)
 
Join Date: Nov 2009
Posts: 8
iTrader: (0)
tehhparadox is an unknown quantity at this point
thanks for the reply

As far as I can see, the nopeople website made the footer tag stay at the bottom with a wrap div.. or am I wrong? how do you suggest I could do to make the tail div tag stay at the bottom?

I'm not very good at html and css. Sorry
tehhparadox is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-04-2009, 12:53 PM
  #6
¥åßßå
Blonde Bimbo
 
¥åßßå's Avatar
 
Join Date: Jul 2004
Posts: 2,244
iTrader: (0)
¥åßßå is a name known to all¥åßßå is a name known to all¥åßßå is a name known to all¥åßßå is a name known to all¥åßßå is a name known to all¥åßßå is a name known to all
You're wrong

Make html && body 100% ... hide the scrolls, slap your content in an absolute div bottom/right 0,0 && 100% width/height ... add an overflow auto and then position your footer absolute ... make sure it's not inside your content/wrap div

Examples of fixed header/footer/other bits ( warning : whore my own sites alert )

fixed header
fixed header/footer
fixed "sidebar"/footer

¥
__________________
I may have opened the door, but you entered of your own free will

¥åßßå is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-04-2009, 01:27 PM
  #7
tehhparadox
Novice (Level 1)
 
Join Date: Nov 2009
Posts: 8
iTrader: (0)
tehhparadox is an unknown quantity at this point
Thank you!

Your instructions were clear and it worked . I will use this technique although (I know I wasn't very clear) in my question I was talking about the footer tag at the bottom that you can see by scrolling down to the bottom, rather than a tag that always stays at the bottom of the browser. Thank you anyway
tehhparadox is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 03:24 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.