PDA

View Full Version : Center Content


AJW06
11-25-2006, 03:30 PM
How can i make some content not be on the side but the center say a margin but i want to put a image on image there so the margin would push everthing across hot can i do this

BonRouge
11-25-2006, 04:39 PM
Please try using sentences.

SWG
11-25-2006, 06:45 PM
Um... I think this is what you mean...

<html>
<head>
<style type="text/css">
#image1 {
align: center;
margin-top: 100px;
}

#image2 {
align: center;
margin-top:110px;
z-index: 2;
}
</style>
</head>
<body>
<div id="image1"><img src="URL TO IMAGE"></div>
<div id="image2"><img src="URL TO IMAGE2"></div>
</body>
</html>


All I caught out of that was image on image, so that's what I did.

AJW06
11-25-2006, 06:52 PM
sorry it didn't make sense i was in a rush

skettino.com you see how this example has like a colum of text how can i achieve that

ess
11-25-2006, 06:55 PM
You can always use the following CSS defintion which would center all the contents of the website.

body{ margin: 10px auto;}

if you want to apply this to a specific tag, such as a DIV...with an id called "displayCenter"

#displayCenter { margin: 0px auto; }

So, you can now place any contents in that div...and it should be centred...

good luck.
Ess

AJW06
11-25-2006, 07:00 PM
how can i make it sligtly off center

SWG
11-25-2006, 07:16 PM
<html>
<head>
<style type="text/css">
#container {
margin-left: 60%;
}
</style>
</head>
<body>
<div id="container">Content 10% off the center of the page.</div>
</body>
</html>

Just a guess. 50% of the page is half of it right? So, 60% is a little off half (center).

VIPStephan
11-26-2006, 02:46 PM
Not really because with margin-left: 50%; you will push the left side of this element to the middle so the element itself won't be slightly off but really off. It depends on the width of the element but something like less than 50% would be more appropriate.