Dynamic Div Size


#1


Ok so i'm trying to make a div the size of the window the user is using. I want it to auto adjust to the width / height of there page depending on there resolution, or even if they simply re-size there browser. Normally I would let things go and just try and figure it out over time when I think it's going to be too much work, but this makes no sense to me. I posted my jsbin below, and to me it "should" work perfectly. Please if someone can shed some light onto why this is not it would be beyond helpful!

JSBIN LINK

Thank you all in advance!


#2

Dynamic width is easiest when set as a percentage.

<body>
<div id="wrapper">

</div>
</body>

The CSS,

#wrapper {
    width: 95%;
    margin: 0 auto;
}

You may wish to look into Twitter Bootstrap CSS which has a column layout that works very well. Also, look into Responsive Design and media queries. These are very useful, as well, but not as well formulated as Bootstrap.


#3

Thank you everyone I received a fix from another source!

I needed this done in javascript, and i was overlooking, ...style.width = .... and height.. I was trying to write with cssText and finding errors. I was so aggrivated I guess that I just wasn't thinking properly.

Thank you so much for your response! And thank you Zain for fixing my link, for some reason i have so much trouble getting them to work in this message board rofl.