Search code examples
csswidthmarginfixedfluid

Fixed Margin & Fluid Width Taking 100% of Parent


How should I make this with CSS:

I would like to have 2 divs, one inside another. Parent div should take 100% of window width, child div should have fixed margins and at the same time fluid width filling 100% of the remained width of the parent. (Parent div - 2 margins of child)

It is pretty obvious how to acomplish this using javascript, but I'm wondering if there is any possibility to acomplish this using only CSS and HTML.

Example picture

P.S. It should be valid for ie8+


Solution

  • Do you want like this?

    DEMO : jsfiddle.net/G5qD3