css - Extend to full width a div inside a contented div -


i have div width set (ex. 980px) , child of div want extend full browser width (without expand parent or overflowing anything).

worthy body positioned relative element (and can't change it).

i thought using absolute element got in trouble other elements near it.

any appreciated.

example

you don't have expand inner div 100% of outer div, if accept things margins , paddings applied usual. take @ example setup you:

http://jsfiddle.net/3e4yy/4/

html:

<div class="outer">     <div class="inner">         inner div automatically takes available width inside parent container element, outer div in case.  inner div automatically takes available width inside parent container element, outer div in case. inner div automatically takes available width inside parent container element, outer div in case.          </div> </div>  <hr>  <div class="outer">     <div class="inner">         inner div automatically takes available width inside parent container element, outer div in case.       </div> </div> 

css:

body {     margin: 0;     padding: 0;     width: 1100px;      height: 500px;     background-color: lightgray; } div {     margin: 0;     padding: 10px; } .outer {     width: 980px;     background-color: blue; } .inner {     background-color: green; } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -