html - DIV as filling block in another DIV -


i have css

.nav {     width: 200px;     line-height: 50px;     float: left; } .content {     margin: 0px 0px 0px 230px; } .container {     border: 1px solid red; } 

and here html

<body> <div class="container">     <div class="nav">some text         <br>more text         <br>even more text     </div>     <div class="content">         <h1>home</h1>         <p>text paragraph</p>     </div> </div> </body> 

this gives me menu on left , content on right. , red box around content on right, half menu on left.

but have red box around complete nav-div can help?

thanks teddy

add overflow:auto container div's css:

.container {     border: 1px solid red;     overflow:auto; } 

jsfiddle example

floating child div removes flow of document , container collapses if didn't exist. adding overflow restores behavior you're after.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -