help! if I am using z-index in my html, will I be able to center my web pages?

  • Thread starter Thread starter jacobjohnfrance
  • Start date Start date
J

jacobjohnfrance

Guest
I am trying to center my web pages (ie to be viewed in the center on the browser) but everything I'm trying isn't budging. I am using z-index tags in my html and someone said this makes the objects appear in a static position on the web page, hence the problem. So what do I need to do to convert my z-index tags to make my whole site appear in the center? Im a noob at this. Thanks in advance
hi, thanks for these. Chris G, I tried what you wrote and all that happens is a grey box appears at the top of the page. The content of the page doesn't move at all! Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
The z-index that you assign to different elements in your web page is supposed to determine which elements appear in front when the position of two elements overlap.

To center your page I would recommend doing this in your css file:

body {
margin:50px 0px;
padding:0px;
text-align:center;
}

div#content {
width:500px;
margin:0px auto;
text-align:left;
padding:15px;
border:1px dashed #333;
background-color:#eee;
}

So your HTML source might look like this:

<!DOCTYPE .../>
<html>
<head>
<title>Test Centering</title>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="content">
<p>The content of your web page here</p>
</div>
</body>
</html>

> This is just an EXAMPLE of what you can do. There are many different ways to center your webpage, but unfortunately without taking a look under the hood I can't give you an answer that will be 100% correct. No one could.

Try going to a mechanic, not telling them anything about your vehicle and expecting them to fix the problem. They'll look at you like you're crazy. =)
 
Back
Top