css - Can't align <div> to center -
i'm trying align 'div' attribute center of page (horizontally). problem whatever attributes i've used, 'div' continues aligned left. 'div' reffering to, page 'div' of webpage, inside 'html' , 'body' attributes. here's css code:
#page{ margin-top:20px; margin-bottom:20px; margin-left: auto; margin-right:auto; border-color: black; border-style: solid; border-width: thin; overflow:auto; padding-bottom: 10px; padding-top: 0px; width:1200px; background-color:#ffffff; font-family:arial, helvetica, sans-serif; color:black; font-size:12px; height:700px; }
and 'html', 'body' css code following:
html,body { background-color:#ffffff; margin-left: auto; margin-right: auto; }
note if remove "overflow" property, div aligned center of page (although, overlays menu on top of it) need "overflow" property automatically add scrollbars if width/height of page displayed inside div greater specified in css.
i haven't coded in awhile, when creating centered page:
html, body { width: 100%; height: 100%; margin: 0 auto; text-align: center; }
then div:
#page { width: 900px; overflow: hidden; text-align: left; margin: 20px 0 20px 0; }
that may or may not work, said, has been awhile.
Comments
Post a Comment