|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am wondering if there is some way to make a <div> layer automatically expand to the full height of the screen similar to the way that one would use width=100% when talking about the width of a page.
I have a layer that I want to extend to the bottom of the page no matter what resolution the user has on their screen. Maybe the layer could just extend all the way until the next layer? Any Ideas? Thanks Jamie |
|
#2
|
|||
|
|||
|
Code:
<style type="text/css">
html, body { height: 100%; }
#MYDIV { height: 100%; }
</style>
That is what you need I believe. Just give your div an id, and put it in the third line above where it says MYDIV. |
|
#3
|
|||
|
|||
|
That did not seem to work. It still gave me a scroll bar on the right even when I only had whitespace below. How does height: 100%; work?
Jamie |
|
#4
|
|||
|
|||
|
The scrollbar could be caused by a non-zero border or margin (depending on the browser). Try this:
Code:
body { border:0; margin: 0; height: 100%; }
#MYDIV { height: 100%; background-color: green;}
Hope this helps, Jeroen |
|
#5
|
|||
|
|||
|
I was experimenting with this yesterday and also found that height : 100% gave an annoying right-side scrollbar. The solution is to find some value like 97% that doesn't give the scrollbar.
Additionally, you have to make sure that if your block is inside another block, that the encapsulating block also has the correct height set. |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > CSS <div> height property |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|