div width 100% of window size - but..
- Started
- Last post
- 3 Responses
- jtb26
inside a body tag set to be 50,000px.
I'm trying to have a sequence of horizontally aligned divs that i scroll between using anchor tags.
But i need each section to be limited to the width of the browser window. (Each div is a different color, and the content is to be centered in the window)
So .section {width:100%} won't cut it.
Can this be achieved with a simple javascript line, or should i just abandon this and go vertical.
- orrinward0
Easy with Javascript, using window.width.
Google something like 'set div to window width in javascript' and have a look through the width()/height() stuff in jQuery.
- orrinward0
Alternatively, have the body set to 100% width/height, with one div inside it set the same with overflow hidden, then have another div inside that with the 50000px width and content in that.
- jtb260
excellent I'll try those both.