html - Center a div inside another div -
i'm trying set div centered inside div.
this html page:
<body> <div id="divparent"> <div id="divheader" > <div id="divheadertext"> </div> </div> <div id="divbody"> </div> </div> </body>
and style:
#divheader { background-color: #c7c7c7; font-family: verdana, geneva, tahoma, sans-serif; height: 80px; margin-bottom: 2px; } #divbody { background-image: url('images/gradientbackground.png'); background-repeat: repeat-x; height: 300px; } #divheadertext { margin: auto; width: 90%; height: 80%; background-color: #00ff00; }
why smallest div doesn't left space on top?
your question unclear.
if you're trying vertically center #divheadertext
within #divheader
, try adding margin-top: 13px;
.
Comments
Post a Comment