Jump to content

Any Idea Why This Won't Center?


knystrom18

Recommended Posts

I have no idea why this refuses to center.

<!DOCTYPE HTML><html lang="en"><head><link rel="shortcut icon" href="images/shortIcon.jpg" /><link rel="stylesheet" type="text/css" href="css/divs.css" /><link rel="stylesheet" type="text/css" href="css/general.css" /><link rel="stylesheet" type="text/css" href="css/content.css" /><link rel="stylesheet" type="text/css" href="css/links.css" /><title>Kyle's Portfolio » Home</title></head><body>    <div class="center">        <div id="shadows">            <div id="allContain">                <header>                    <a href="index.html"><img src="images/banner.jpg" alt="« Back Home" /></a>                </header>            </div><!--allContain-->        </div><!--shadows-->    </div><!--center--></body></html>

The accompanying css:

@charset "utf-8";/* divs.css */.center {	border: solid 5px #f00;	margin: 0px 0px 0px 0px;	background-image: url(../images/backgrounds/stripe.png);	background-repeat: repeat;	text-align: center;}#shadows {	border: solid 1px #fff;	background-color: #000;	/*still need to make background image*/	width: 900px;}#allContain {	border: solid 1px #fff;	margin-left: 20px;	margin-right: 20px;}

Thanks!

Link to comment
Share on other sites

text-align only centers text within an element. If you apply "auto" to the margin of an element with a fixed width, it will put an equal margin on each side, which will center it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...