Reply
Old 05-18-2006, 09:59 AM Div's question
Experienced Talker

Posts: 49
Trades: 0
Hi,

I am starting building tableless layouts and i was wondering.

how do i get a div to span the complete height(100% height) of the site?

Jaap Bakker
Bloem Media
__________________
Bloem Media: a freelance webdesign service blog!
Halbarad is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 05-18-2006, 10:37 AM Re: Div's question
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
With difficulty...
You need to set either the HTML element or the Body element to 100% height (can't remember which it was):
Code:
 
body {
   height: 100%;
}
then you can set the DIV to be 100% of the height of the body, which should now be 100% of the viewport.

As far as I remember from when I tried this though, it's pretty hard to work with in some situations, I think it messes up when you resize the browser window.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"
Inoxia Pyrotechnics Supplies | Surrey Angels Cheerleading Squad
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 05-18-2006, 03:56 PM Re: Div's question
vangogh's Avatar
Post Impressionist

Posts: 9,840
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I think it works unless the page is long enough to go past the window size (since it's then greater than 100%) and then it has problems with the resize. It might only be IE that has the issue though I could be wrong.

I agree though that it can be hard to work with. I prefer just getting various elements and divs to be 100% of the overall container instead of the window.

I think you're right too about it just being the body where you need to add the 100% and the div inside of course.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-23-2006, 09:21 AM Re: Div's question
pjb007's Avatar
Super Talker

Posts: 100
Location: UK
Trades: 0
I am doing this and am having problems, the result is that the pages goes beyond the end of the screen, when there is not enough content for it to do so.

css (only relevent bits included)
Code:
html {
 height: 100%;
 }

.heightset {
 height:100%;
 }

body{
 margin:0 auto;
 padding:0;     
 background:#DDECFE;
 color:#333333;
 width:700px;
 height:100%;
 }
 	
#hdr{
 width: 100%;
 margin: 0;
 border-width: 0 0 0 0;
 background: #eeeeee;
 color: #333333;
 }
   
#lh-col{
 width:75%;
 height:100%;
 float:left;
 border:solid #333333;
 border-width:0 0 0 0;
 background:#ffffff;
 color:#333333;
 margin:0;
 padding:10px;
 }

#rh-col{
 background: #c0c0c0;
 color: #333333;
 margin: 0;
 border: 0;
 padding: 10px;
 margin-left:32em;
 }

Page template (excluding head)
Code:
<body>
<div class="heightset">

	<!-- start of header -->
	<div id="hdr"><? include('ssi/top.php'); ?></div>
	<!-- end of header -->

	<!-- start of left column -->
	<div id="lh-col">
  		<p class="lefttitle">Title</p>
  		<p class="lefttext">
		Main text here
		</p>
	</div>
	<!-- end of left column -->

	<!-- start of right column -->
	<div id="rh-col">
		<div class="righttitle">Title</div> 
		<div class="righttext">Details</div>
	</div>
	<!-- end of right column -->
</div>
</body>
__________________
pjb007

Last edited by pjb007; 05-23-2006 at 09:37 AM..
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
Old 05-23-2006, 09:52 AM Re: Div's question
LadynRed's Avatar
Super Moderator

Posts: 9,033
Location: Tennessee
Trades: 0
I guess I don't understand everyone's obsession with this. Trust me, users don't care, it's the content that matters to them. As a designer I understand wanting it to look just the way you want it, but in the end you just have to let go of this pixel-perfect idea - you'll drive yourself around the bend.

I almost always use the faux-columns method to make columns appear equal length and I don't bother with trying to make it fill the entire window vertically. There are problems with all the 100% methods, and they're easy to avoid.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Div's question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.09831 seconds with 13 queries