Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > HTML, XHTML and CSS

Reply
 
LinkBack Thread Tools
Old August 19th, 2009, 01:01 PM   #1
WebForumz Member
 

Join Date: Apr 2008
Location: USA
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 galahad3 is on a distinguished road
Positioning in IE6

I've been trying to centrally position my site pages in IE6 but despite using what seems to be the correct and accepted code (though perhaps not as the case may be), in IE6 the site pages keep aligning left.

In IE7/8, FF etc. the alignment is centered and fine.

The CSS I'm using is:

/* global to standardise padding etc. */

* {
padding:0;
margin:0;
border:0;
line-height:0;
}

body {
margin: 0;
padding: 0;
text-align: center;
background: #ffffff;
font-family:Arial, Helvetica, sans-serif;
overflow:auto;
height:100%;
}

#container {
width: 1002px;
background: #ffffff;
margin: 0 auto;
text-align: left;
height:auto;
}

This CSS works fine (in IE6) on another site, i.e centers ok.

Some articles talk about IE6 being funny with XHTML doctypes, so I swapped it for an HTML Transitional doctype- but that wouldn't work either.

Any ideas as to how I can make the site centered properly in IE6? As far as I can tell the above code should work- but doesn't...
galahad3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 19th, 2009, 03:45 PM   #2
New Member
 

Join Date: Aug 2009
Location: United States
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 colmustard is on a distinguished road
Re: Positioning in IE6

I think you should take a good look at this diagram
http://www.w3.org/TR/2005/WD-css3-ba...d-20050216/box

that explains how padding, and margins work very well, so I think once you understand this concept it becomes 2nd nature to position elements as you want.

________________________________________

For ideas on how to solve your problem, if all else fails, try this:

CSS

body {
margin: 0;
padding: 0;
background: #fff;
font-family: Arial, Helvetica, sans-serif;
}

#container {
width: 1002px;
background: #fff;
margin: 0 auto;
padding: 0;
}
#container div {
width: 1002px;
background: #000; /*change to what you want*/
margin: 0 auto;
padding: 0;
}

HTML

<div id="container">
<div>test</div>
</div>


That worked perfect in my test, but remember that its not the smartest solution, it requires unnecessary div tags, but if you can't get it to work and you don't mind the clutter then its fine
colmustard is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 19th, 2009, 03:57 PM   #3
WebForumz Member
 

Join Date: Apr 2008
Location: USA
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 galahad3 is on a distinguished road
Re: Positioning in IE6

Didn't work unfortunately, IE6 still positions everything left...

I used:

body {
margin: 0;
padding: 0;
text-align: center;
background: #ffffff;
font-family:Arial, Helvetica, sans-serif;
overflow:auto;
height:100%;
}

#container {
width: 1002px;
background: #ffffff;
margin: 0 auto;
text-align: left;
height:auto;
padding:0;
}

#innercontainer {
width: 1002px;
background: #ffffff;
margin: 0 auto;
padding:0;
}

So everything is wrapped inside #innercontainer which itself is wrapped inside #container.

???
galahad3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 19th, 2009, 10:16 PM   #4
New Member
 

Join Date: Aug 2009
Location: United States
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 colmustard is on a distinguished road
Re: Positioning in IE6

why did you change it?

You have useless rules in there that aren't making your site but breaking it, and the code I wrote tested and worked perfect.

The reason my code worked in ie6 was because it gave a set width of 100% to the content inside the container, and then set a width of 1002px with equal margins on either side to center it inside that original 100% width.

Just use what I gave you, and you don't want to change the id, just stick with the #container.
colmustard is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 20th, 2009, 04:46 AM   #5
WebForumz Member
 

Join Date: Apr 2008
Location: USA
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 galahad3 is on a distinguished road
Re: Positioning in IE6

Okay, I've now used this:

body {
margin: 0;
padding: 0;
text-align: center;
background: #fff;
font-family:Arial, Helvetica, sans-serif;
}
#container {
width: 1002px;
background: #ffffff;
margin: 0 auto;
text-align: left;
height:auto;
padding:0;
}
#container div {
width: 1002px;
background: #fff; /*change to what you want*/
margin: 0 auto;
padding: 0;
}

(Keeping the text-align statements in order to keep it centred in IE7/8 and FF).

Unfortunately this has had the effect of throwing the page conten t and divs all over the place and messing the page up completely...

However if I take out the #container div it's then ok again in IE7/8 and FF.

Still the long-standing left-align issue in IE6.
galahad3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 21st, 2009, 01:13 PM   #6
New Member
 

Join Date: Aug 2009
Location: United States
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 colmustard is on a distinguished road
Re: Positioning in IE6

I'm gona need to see the actual page to figure this out then, because theres something your not giving me that's breaking it.
colmustard is offline  
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

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Positioning between <h3> konnor5092 HTML, XHTML and CSS 3 September 11th, 2007 06:37 PM
A Better Way of Positioning ChrisTheSoul HTML, XHTML and CSS 10 July 27th, 2007 10:33 AM
positioning alexgeek HTML, XHTML and CSS 18 July 13th, 2007 01:55 PM
positioning with CSS Craigj1303 HTML, XHTML and CSS 8 April 24th, 2007 11:03 AM
div positioning benbacardi HTML, XHTML and CSS 10 May 24th, 2004 08:25 AM


Search Engine Optimization by vBSEO 3.2.0 RC8