IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

Fixed Centred Layout

, Learn how to code that popular Centred/Fixed width layout...


encryptedwrath
no avatar
Advanced Member
*******
Group: Members
Posts: 123
Joined: 15-January 08
From: Bristol
Member No.: 56,299
myCENT:25.91



Post #1 post Oct 30 2008, 07:04 PM
I remember learning this so long ago after piecing together some tutorials.

First , put together your basic HTML Code. Nothing complicated , but it should probably look like this;
[codebox]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type" />
<title>Your Site Name</title>
</head>
<body>
<div id="layout">
All but All content should be here
</div>

</body>
</html>
[/codebox]

The ID is important. It doesn't matter what you ID/Class it as , as long as it has a value/Id smile.gif. The entire tutorial is useless otherwise

Open a new CSS file , or make a new one in notepad
[codebox]
body {
text-align: center;
}

#container {
margin: 0 auto;
width: abcpx;
text-align: left;
}
[/codebox]
Body defines the entire document. The Body text align; center is used for the general code.The container tag defines the container ID we declared earlier smile.gif.The Textalign left means all text within the container will be aligned left wink.gif. The Margin tag defines no Margins on top or bottom but auto margins on the left. So replace Abc with whatever width you care to add , and the layout will be centred according to that width.

That's essentially it. There are several other tweaks , but aren't really neccesary. Hoping I helped in some way , Encryptedwrath smile.gif

NOTES:
1) The text align is compulsary for IE users. Other browsers display the code fine without it smile.gif

This post has been edited by encryptedwrath: Oct 30 2008, 07:19 PM
Go to the top of the page
+Quote Post
pyost
no avatar
Newbie [Level 2]
**
Group: Members
Posts: 31
Joined: 22-November 07
From: Belgrade, Serbia
Member No.: 53,492
myCENT:96.64



Post #2 post Oct 30 2008, 07:12 PM
I would just like to add why it is necessary to use text-align: center. If you tried creating a layout with that line of CSS code, everything would look fine in Opera and Firefox, which is how it should work. However, in IE, it would not. That's why you have to add text-align: center, which, oddly enough, helps. Why oddly enough? Well, the name says it all - text-align, not div-align. After all, it's Microsoft we are talking about and their lack of respect for WWW standards.
Go to the top of the page
+Quote Post
encryptedwrath
no avatar
Advanced Member
*******
Group: Members
Posts: 123
Joined: 15-January 08
From: Bristol
Member No.: 56,299
myCENT:25.91



Post #3 post Oct 30 2008, 07:18 PM
Thanks Pyost , will add that in smile.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   0 Trystim 3,498 20th September 2004 - 02:52 PM
Last post by: Trystim
No New Posts   4 BoSZ 9,085 21st October 2004 - 09:43 PM
Last post by: Jeremie
No New Posts   1 faceofdie 6,128 17th November 2004 - 06:47 PM
Last post by: serverph
No New Posts 10 serverph 1,436 15th July 2007 - 12:47 AM
Last post by: homespeaker
No New Posts   3 MSTR 3,364 11th December 2004 - 10:28 AM
Last post by: wassie
No New Posts   8 Graeme 1,019 2nd July 2007 - 12:31 PM
Last post by: Graeme
No new 47 finaldesign 13,947 22nd April 2005 - 09:58 PM
Last post by: finaldesign
No New Posts   10 darran 1,528 10th February 2009 - 04:11 AM
Last post by: novoAlias
No New Posts   8 googlue 4,151 27th January 2005 - 08:10 AM
Last post by: googlue
No New Posts   0 dark 2,470 27th January 2005 - 06:13 PM
Last post by: dark
No New Posts 1 mahesh2k 4,328 19th February 2005 - 03:59 PM
Last post by: Klas2B
No New Posts   8 encryptedwrath 872 2nd January 2009 - 08:45 AM
Last post by: triplebtalk
No New Posts 8 soulnetwork_tk 3,303 8th March 2005 - 08:19 PM
Last post by: soulnetwork_tk
No New Posts   13 the_furious1 7,922 22nd March 2005 - 04:52 PM
Last post by: Becca
No New Posts   3 electriic ink 924 28th May 2006 - 04:41 AM
Last post by: OpaQue


 



RSS Open Discussion Time is now: 22nd November 2009 - 09:50 AM

Web Hosting Powered by ComputingHost.com.