I want to have a fixed width <div> on the left, and a flexible <div> on the right for when the window resizes. Also, The left <div> is collapsible (I use jQuery to hide it with negative margin), Then I need the right <div> to have the full width.
PS: I’m not being able to have a 100% width div inside a container with padding without having horizontal scrolls…
float: leftonly the leftdiv, and addoverflow: hiddento the rightdiv.See: http://jsfiddle.net/JsLuG/
That works with my method: http://jsfiddle.net/JsLuG/1/
That’s because
width: 100%does not includepadding.See: http://css-tricks.com/2841-the-css-box-model/
The simplest way to work around this is to not declare
width: 100%. A block-level element will default to taking the “full width” (width: auto).Or, add a wrapper element and put the
paddingon that. Or, usebox-sizing: border-box.