Jump to content

centering divs and stuff


real_illusions

Recommended Posts

i got a problemi've searched on the forum but i couldn't find anything that suited my needs, and also on the web too.maybe i'm not searching for the right things.i had some code that centered the page nicely.but for some reason it doesn't work when i put in some new content.div html

<div id="outer"><div align="center" id="header" style="border: 3px #00ff0c solid; "></div><div align="center" id="content1" style="border: 2px silver solid; border-top: 3px silver solid; "></div></div><div id="main" style="border: 2px silver solid; z-index:1; position:relative; top:-50px; left:0px; "></div></div>

css

div#outer {width: 80%;margin-top: 20px;margin-bottom: 50px;margin-left: auto;margin-right: auto;padding: 0px;}div#header {background-image:url('backgroundimage.jpg');padding: 15px;margin: 0px;text-align:left;}div#content1 {padding-bottom: 10px;padding-left: 0px;padding-right: 0px;padding-top: 0px;margin-top: 1px;}div#main {margin-left: 10%;margin-right:10%;padding: 0px;}

i dont know how theres an extra closing div tag in the code..its been a while since i've worked with the code.and i've always thought class should be used instead of id.has anyone got a simpler code for centering a page usng divs?i just got a flash movie (800x300) and some other small pictures and a small menu which can go in some other divs probably inside a main outer div.

Link to comment
Share on other sites

i got a problemi've searched on the forum but i couldn't find anything that suited my needs, and also on the web too.maybe i'm not searching for the right things.i had some code that centered the page nicely.but for some reason it doesn't work when i put in some new content.div html
<div id="outer"><div align="center" id="header" style="border: 3px #00ff0c solid; "></div><div align="center" id="content1" style="border: 2px silver solid; border-top: 3px silver solid; "></div></div><div id="main" style="border: 2px silver solid; z-index:1; position:relative; top:-50px; left:0px; "></div></div>

css

div#outer {width: 80%;margin-top: 20px;margin-bottom: 50px;margin-left: auto;margin-right: auto;padding: 0px;}div#header {background-image:url('backgroundimage.jpg');padding: 15px;margin: 0px;text-align:left;}div#content1 {padding-bottom: 10px;padding-left: 0px;padding-right: 0px;padding-top: 0px;margin-top: 1px;}div#main {margin-left: 10%;margin-right:10%;padding: 0px;}

i dont know how theres an extra closing div tag in the code..its been a while since i've worked with the code.and i've always thought class should be used instead of id.has anyone got a simpler code for centering a page usng divs?i just got a flash movie (800x300) and some other small pictures and a small menu which can go in some other divs probably inside a main outer div.

In the style or CSS put
.cent {text-align: center; }

In the body put

<div class=center>lots of text</div>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...