CSS layout HELP!!

This is a discussion on "CSS layout HELP!!" within the Web Page Design section. This forum, and the thread "CSS layout HELP!! 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 Aug 27th, 2005, 23:01
New Member
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
CSS layout HELP!!

I am trying to layout my site with CSS, and have managed to get the layout spot on. However, I've realised, as i've set each DIV as position absolute, I can't centre the whole page. I've tried taking off all the position absolute settings, but layout goes to pot.

I want to keep the contentmiddle (body text) section at the top of the body text to help with SEO, but can't work out a way to do this without using position absolute.

any ideas????

Thank you in advance

Dave

The site is: www.winstonsweb.co.uk/div but is totally far from finished!
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 Aug 28th, 2005, 05:09
Reputable Member
Join Date: Jul 2005
Location: Indiana, USA
Age: 29
Posts: 153
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
I am not really the best person to help you out as I am just learning CSS myself. So I will let the CSS experts help you solve your problem


However with that said, I have a few suggestions and things I have picked up regarding CSS lately:
- absolute positioning is not good, use rarely
- make sure your site is cross-browser compatible (looks like it looks good in IE, but a few things are off in FireFox)

Good luck, and I can't wait to see how to fix it so I can learn too !
Last Blog Entry: Whats in a name? (Feb 20th, 2008)
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 Aug 28th, 2005, 09:00
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
As a long-shot, try adding to your CSS:

#center { position:relative; margin:auto } and removing the (deprecated) <div align="center"> tag from your code.

All your Absolute measurements should then be relative to the parent container (#center) which means everything moves over to the middle nicely.

Absolute/Relative positioning is an 'ideal' that the browsers have yet to catch up to, So I'd repeat the advise given and stick to using Floats for the duration.
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 Aug 28th, 2005, 12:43
Junior Member
Join Date: Aug 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
If I understand your question correctly, I just wrote about this for a how-to I'm putting on my website...so I pasted it below. Notice that there is no position attibute and it works in IE and FF.

* Set text-align: center for the <body>. This code will center all page content.
* Place your page text in a <div> that will be the main section for all your page content
* Set the following styles for the main <div>
o width: 720px - set the size as appropriate for your page
o margin-left: auto; - <div> wants to be centered, so let the browser do it automatically
o maring-right: auto; - <div> wants to be centered, so let the browser do it automatically
o text-align: left; - now set the text to be left aligned within the main <div> block


That should do it. I use it on everything I do.
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 Aug 28th, 2005, 13:29
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
Hey RaptorRex, don't forget that;

margin-left:auto
margin-right:auto

can be shortened to;

margin:auto

- much quicker to write and less to send to the client.

if you want to add a top and bottom margin of say, 10px write it like:

margin: 10px auto
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 Sep 2nd, 2005, 00:32
Junior Member
Join Date: Sep 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
This should do the trick:

Code: Select all
body {
text-align: center;
}

div#pagewidth {
position: relative;
margin: 0 auto;
text-align: left;
}
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 Sep 5th, 2005, 07:42
New Member
Join Date: Aug 2005
Location: USA
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Interesting, i had the same problem. Great fixes guys.
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 Sep 6th, 2005, 04:16
Junior Member
Join Date: Aug 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
I should have included this in my original post. Here are the details on setting margins:

http://www.w3.org/TR/CSS1#margin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Sep 22nd, 2005, 07:19
New Member
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
This may help you

remove align = "center" from your tag.

dont use absolute ,

and use #center { position:relative; margin:auto } in your css.

THis may help you.
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
css, layout, help

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
CSS layout casho Web Page Design 4 Feb 10th, 2008 13:59
Layout using CSS Madball Web Page Design 5 Nov 7th, 2007 09:41
New to CSS Layout tapster Web Page Design 15 Oct 15th, 2007 10:18
Fluid layout - IE6 clichés the layout when resizing cyberseed Web Page Design 7 Jun 16th, 2007 05:14
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 22:17.


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