html - top margin is not working inside div -


i have 2 divs..

css

#content {     background: url('../images/bg.jpg') no-repeat left;     width: 100%;     height: 811px; } #welcome {     background: #fff;     width: 600px;     height: 50px;     color: #000;     margin-top: 200px; } 

html

<div id="content">     <div id="welcome">         welcome     </div> </div> 

the margin moving parent div, not inside one. tried give padding parent div, same thing. how solve?

try adding overflow:hidden; parent

#content{   background:url('../images/bg.jpg') no-repeat left;   width:100%;   height:811px;   overflow:hidden;   border: 1px solid; /*remove*/ } #welcome {   border: 1px solid; /*remove*/   background:#fff;   width:600px;   height:50px;   color:#000;   margin-top:200px; } 

here have example:

http://jsfiddle.net/jmbj9/

(i added borders can see it)


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -