|
-
Apr 19th, 2002, 01:24 PM
#1
Thread Starter
Frenzied Member
(CSS) defining a div's height relitave to the window size
I am trying to set a divs height to 100% but it is not listening.
Code:
<div style="width:100%;height:100%;overflow:auto;text-align:center;background:red;">
(i put the style for the sake of simplifying this post). If i set it to a specific size (not %) it will do it. Can anyone tell my why it wont work or another way to go about it?
thanks
michael
Last edited by msimmons; Apr 19th, 2002 at 01:29 PM.
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
Apr 19th, 2002, 01:32 PM
#2
Thread Starter
Frenzied Member
ok, it looks like if the 'containing block' (containing the item w/a height%) doesn't have a height specified then a %height is treated like auto... the containg block is my <body> so what to do?
thanks michael
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
Apr 19th, 2002, 04:46 PM
#3
put the whole thing in a table at 100%
-
Apr 19th, 2002, 05:00 PM
#4
Thread Starter
Frenzied Member
man... now why didnt i think of that... i wasted all day thinking (or avoiding) on that prob.
thanks!
michael
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
Apr 24th, 2002, 05:02 PM
#5
Frenzied Member
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test Page</title>
<style type="text/css">
.Container {
height: 100%;
width: 100%;
background-color: red;
color: black;
}
</style>
</head>
<body>
<div class="Container">
</div>
</body>
</html>
This works, and you don't have to hork your page with a table. Also, try setting the padding and margins to zero, or making the div position: absolute, so it won't be contained by the body block. For more fun, try setting the dimensions to 110%.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Apr 24th, 2002, 05:09 PM
#6
Frenzied Member
Sorry, had too much fun...
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test Page</title>
<style type="text/css">
body {
padding: 0px;
}
.Container {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
background-color: red;
color: black;
}
</style>
</head>
<body>
<div class="Container">
</div>
</body>
</html>
That is the same as setting the body's background-color to red.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
May 6th, 2002, 09:58 AM
#7
Thread Starter
Frenzied Member
The 'content' div idea didnt have the desired effect. I am trying to get the overflow value to work on a div so that when the content is more than the size of the window (this is a popup that is dynamic so I never know how much data is going to be inside) it creates a scrollbar.
The table idea did work but I prefer divs.
thanks,
Michael
ps sorry about the late response... being the only comp person in the dept I jump from proj to proj.
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
May 6th, 2002, 11:29 AM
#8
Frenzied Member
And "auto"and "scroll" don't work for "overflow" values?
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
May 6th, 2002, 11:32 AM
#9
Thread Starter
Frenzied Member
Code:
<div style="width:100%;height:100%;overflow:auto;text-align:center;">
works when inside of a 100% table but that was the only way I could get it to work.
Michael
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
May 6th, 2002, 11:57 AM
#10
Frenzied Member
Dude, I have no idea what you are trying to do then.
If this doesn't work, then explain again what you want.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test Page</title>
<style type="text/css">
body {
padding: 0px;
}
.Container {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
background-color: red;
color: black;
overflow: auto;
text-align: center;
}
</style>
</head>
<body>
<div class="Container">
<span>Sample Text</span>
</div>
</body>
</html>
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
May 6th, 2002, 01:12 PM
#11
Thread Starter
Frenzied Member
When I use the example you are posting it works perfectly but when I impliment it into my existing page the scrollbars appear late and the down arrow is just off screen. It's working fine w/the table so no worries.
Thanks
Michael
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|