Centering Layout

This is a discussion on "Centering Layout" within the Web Page Design section. This forum, and the thread "Centering Layout are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jan 8th, 2006, 14:24
csa csa is offline
Up'n'Coming Member
Join Date: Nov 2005
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Centering Layout

Could someone please help me with the positioning of my page layout? I want my site to appear centered, but if viewed in 800x600 it will still show all of the site. I realise I must need to remove the left and right margin in container, but I'm just not sure what with. Sorry there's a lot of code, I just thought it might be better to post everything, as I have a feeling that it might not worked based on the way I've produced the site.

Code: Select all
/* CSS Document */
body{
margin:0px;
padding:0px;
font-family:Arial, Helvetica, sans-serif;
color:#000000;
background-color:#FFFFFF;
text-align:left;
}
#container{
width: 760px;
border: solid black 1px; 
margin-left: 10px;
margin-right:30px;
border: solid black 1px; 
height: 595px;
}
#main{
margin-left: 30px;
margin-right:30px;
}
#topheader{
height: 110px;
background-image:url(images/signpostheader.jpg);
background-repeat:no-repeat;
}
#left{
width: 155px;
float:left;
height: 350px;
background-color:#1177AA;
}
#center{
width: 388px;
height: 340px;
float:right;
text-align:right;
padding-right: 15px;
padding-top: 10px;
background-position: top right;
background-color:#FDF7E1;
}
#right{
width: 180px;
height: 350px;
float:right;
margin-left: -5px;
background-image:url(images/greyleft.gif);
background-color:#cccccc;
}
#topbandhome{
width: 171px;
height: 25px;
margin-top:85px;
float:right;
margin-left: -5px;
background-color:#cccccc;
}
#topbandstrip{
width: 580px;
height: 25px;
margin-top:85px;
float:left;
background-color:#1177AA;
}
#homeimage{
width: 800px;
height:95px;
background-image:url(images/exampleimage.gif);
background-color:#66CC66;
}
/* menu */
#navlist
{
color: white;
background: #17a;
border-bottom: 0.2em solid #17a;
border-right: 0.2em solid #17a;
padding: 0 1px;
margin-left: 5px;
width: 12em;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
font-weight:bold;
}
#navlist li
{
list-style: none;
margin: 0;
font-size: 1em;
}
#navlist a
{
display: block;
text-decoration: none;
margin-bottom: 0.5em;
margin-top: 0.5em;
color: white;
background: #39c;
border-width: 1px;
border-style: solid;
border-color: #5bd #035 #068 #6cf;
border-left: 1em solid #fc0;
padding: 3px;
padding-left: 10px;
}
#navlist a#current { border-color: #5bd #035 #068 #f30; 
}
#navlist a
{
width: 99%;
/* only necessary for Internet Explorer */
}
#navlist a
{
voice-family: "\"}\"";
voice-family: inherit;
width: 10.6em;
/* Tantek-hack should only used if Internet-Explorer 6 is in standards-compliant mode */
}
#navcontainer>#navlist a
{
width: auto;
/* only necessary if you use the hacks above for the Internet Explorer */
}
#navlist a:hover, #navlist a#current:hover
{
background: #28b;
border-color: #069 #6cf #5bd #fc0;
padding: 3px;
padding-left: 10px;
}
#navlist a:active, #navlist a#current:active
{
background: #17a;
border-color: #069 #6cf #5bd white;
padding: 3px;
padding-left: 10px;
}
/* bodytext */
.welcometxt{
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
font-weight:bold;
text-align:left;
margin-left:5px;
}
h1 {
 margin:0px 0px 5px 15px;
 font-size:12px;
 font-weight:bold;
 color:#000000;
 text-align:left;
 }
p {
 font:11px/20px verdana, arial, helvetica, sans-serif;
 margin:0px 0px 16px 15px;
 padding:0px;
 text-align:left;
 }
 .righttext{
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
text-align:left;
margin:30px 3px 0px 15px;
}
/* rightlist */
#rightlist{
color: black;
margin:0px 0px 0px -30px;
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
font-weight:bold;
text-align:left;
float:left;
padding-left: 8px;
}
#rightlist ul li
{
list-style: none;
}
/* bottomlist */
#bottomlist{
width: 500px;
font-family:Arial, Helvetica, sans-serif;
font-size:10px;
color:#999999;
text-align:center;
padding-left: 140px;
}
a.bottomlist{
text-decoration:none;
color:#999999;
}
a.bottomlist:hover{
color:#999999;
text-decoration:underline;
}
/* toptelephone */
.telephone{
padding-top: 4px;
padding-left: 8px;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
color:#3399CC;
letter-spacing: 1px;
}
/* w3c */
#w3c{
width: 150px;
float:left;
padding-left: 12px;
margin:0px;
padding-top:0px;
margin-top: 0px;
}
html
Code: Select all
<div id="container">
<div id="topheader">
<div id="topbandstrip"></div>
<div id="topbandhome">
<div class="telephone">Tel: 08992 667 613</div>
</div><!--topbandhome end div-->
</div>
<div id="homeimage"></div>
<div id="right">
<div class="righttext">Some text here.</div><br>
<h1>Services</h1>
<div id="rightlist">
<ul>
<li>One</li>
<li>Two</li>
</ul>
</div>
</div><!--left end div-->
<div id="center">
<h1>Welcome </h1>
<p>Some text to go here.</p>
 
</div><!--left end div-->
<div id="left">
<div id="navcontainer">
<ul id="navlist">
<li id="active"><a href="#" id="current">Welcome</a></li>
<li><a href="#">one</a></li>
<li><a href="#">two</a></li>
<li><a href="#">three</a></li>
<div id="w3c"><img src="http://www.webforumz.com/images/w3c.gif" alt="W3C Accessibility" width="59" height="21"></div>
</ul>
</div>
</div><!--left end div-->
<div id="bottomlist">
Copyright 2006 <a href="http://www.handsfree.co.uk/terms.pdf" class="bottomlist">Terms</a> | <a href="http://www.handsfree.co.uk/privacy.pdf" class="bottomlist">Privacy</a><br>
Wenwroth Way, Tembridge, West Hants Tel: 666 612813<br> 
Email: <a href="mailto:enquiries@handfrees.co.uk" class="bottomlist">enquiries@handsfree.co.uk</a></div>
<!--bottomlist end div-->
<!--end div-->
</div>

Last edited by csa; Jan 8th, 2006 at 14:37.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jan 8th, 2006, 15:49
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,188
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
Re: Centering Layout

Hey CSA.... it should not be that hard as you are using relative positioning over absolute..... so can you post up the URL so i can see more clearly how it sits?
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jan 8th, 2006, 16:15
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centering Layout

Change the #container CSS to this:
#container {
width: 760px;
border: solid black 1px;
position: relative;
left: 50%;
margin-left: -380px;

border: solid black 1px;
height: 595px;
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jan 8th, 2006, 17:05
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,188
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
Re: Centering Layout

Hey herkulees..... I've seen that used before, but I'm sure that breaks in a few browsers..... have you got any test cases for this?
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jan 8th, 2006, 17:19
Junior Member
Join Date: Jan 2006
Age: 30
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centering Layout

rob, i use that method on just about every site I do and the only browser that has problems, you guessed, mac ie.

example site: not done yet: http://www.schafertmd.com/tmd2005
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Jan 8th, 2006, 17:20
Junior Member
Join Date: Jan 2006
Age: 30
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centering Layout

this is the css file http://www.schafertmd.com/tmd2005/co.../layout_v2.css
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Jan 8th, 2006, 17:24
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,188
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
Re: Centering Layout

hmmm.... nice one.

Mac IE is the least of most people's worries, so OK, I guess!
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Jan 9th, 2006, 14:56
csa csa is offline
Up'n'Coming Member
Join Date: Nov 2005
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centering Layout

Thank you everyone. This works, and I now know for next time.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
centering, layout

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vertical centering - please help! mpnuttall Web Page Design 6 Apr 16th, 2008 11:38
centering help please RZX Developer Web Page Design 7 Aug 2nd, 2007 11:58
Fluid layout - IE6 clichés the layout when resizing cyberseed Web Page Design 7 Jun 16th, 2007 05:14
Centering a DIV johnmr Web Page Design 12 Sep 13th, 2006 13:07
What makes a layout a good layout? Miles Lombardi Graphics and 3D 4 Jul 26th, 2005 03:22


All times are GMT. The time now is 14:32.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42