html - HTML5/CSS3 proprely lining up elements -
i building website 3 "main" elements, banner, nav section , content section (see joint image) site plane. however, know "proper" way line different elements on vertical (i mean left - right) axis using css propreties. have investigated static, absolute, relative attributes nothing quite worked. i'm doing wrong should do?
here's css code
@font-face { font-family: florsn17; src: url('fonts/florsn17.ttf'); } ::-webkit-scrollbar { width: 12px; } ::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px gray; border-radius: 10px; } ::-webkit-scrollbar-thumb { border-radius: 10px; -webkit-box-shadow: inset 0 0 6px white; } body { font-family:arial,helvettica,sans-serrif; background-image:url("images/background.jpg"); background-color:black; } header { background-color:black; height:300px; width:720px; float:center; border-style:ridge; border-width:1px; margin-left:auto; margin-right:auto; } div#center { background-color:#333; background-image:url("images/menubarbackground.jpg"); border-style:ridge; border-width:1px; width:720px; height:86px; margin-left:-1px; margin-right:auto; } li#item_home { margin-left:-40px; margin-top:-16px; } ul#menu li { float: left; list-style-type:none; padding:0px; } li { display: block; color: white; text-align: center; text-decoration: none; padding:16px; padding-right:30px; padding-left:30px; } li a:hover { background-color: #111; } .current { background-color:#111; } #mainsection{ background-color:#262626; opacity:0.8; position:relative; top:20px; left:-112px; width:720px; border-style:ridge; border-width:1px; overflow:auto; } #mainsection article { font-family: florsn17,arial,helvettica,sans-serrif; color:white; padding:20px; line-height:1.5em; } #video { padding-bottom:10px; } #googlemapscreencap { padding-top:20px; padding-bottom:10px; }
thanks help!
i suppose header
banner, div#center
nav , #mainsection
content. first of all, saw of them have, example, width:720px;
can create wrapper(div) contains of them, or class give them same width (and attributes have in common). wrapper best option. also, in wrapper/class set margin: 0 auto;
center them.
Comments
Post a Comment