Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > All Around Tutorials
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 12-07-2006, 12:53 PM
  #1
karinne
\m/\m/
 
Join Date: Dec 2002
Location: QC, Canada
Posts: 4,297
iTrader: (0)
karinne is on a distinguished road
[CSS] How to center your site horizontally

The code is rather simple: margin: 0 auto; and a width: 780px (which should be changed to accommodate the width you have set-up for you site).


Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-CA" xml:lang="EN-CA">

<head>
	<title>Some title</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	
	<style type="text/css">
	body {
		color: #fff;
	}
	
	#wrap {
		margin: 0 auto;
		width: 780px;
		background-color: #900;
	}
	</style>	
</head>

<body>

<div id="wrap">
	this box is centered
</div>

</body>
</html>
If you need to support IE5 browsers, add a text-align: center; in the body { }. And you might also want to add a text-align: left; to #wrap { } to realign your text to the left
__________________
[a web design portfolio - AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
I'm also on: del.icio.us | flickr | virb | facebook | twitter
karinne is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 06-28-2007, 01:18 AM
  #2
master1425
Chevalier (Level 6)
 
Join Date: Jun 2007
Posts: 52
iTrader: (0)
master1425 is an unknown quantity at this point
Ok, I have a question about this.

For instance, say someone is using a widescreen laptop, if I set mine to 768, will it center everything when they look at it too?

www.southerngamingclan.com

That is a site, that I use, that if you view it in anything other than 1024X768, it does not show up right.

So, if thats added, will it fix it?
master1425 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 09:27 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.