CSS in IE and Firefox is driving me nuts

This is a discussion on "CSS in IE and Firefox is driving me nuts" within the Web Page Design section. This forum, and the thread "CSS in IE and Firefox is driving me nuts 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


Closed Thread
 
LinkBack Thread Tools
  #1  
Old May 17th, 2005, 23:02
Reputable Member
Join Date: May 2005
Location: Sheffield
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
CSS in IE and Firefox is driving me nuts

So im building a site using CSS, have to say there is alot more smooth control compared to using tables.

So I had the page looking spot on in Internet Explorer only to open it up in Firefox and its been blasted appart.

Spent the next hour or so moving the div tags. Altering absolute/relative positioning. Altering the postition, for margin, then padding. aAHAHA

Still no compromise between the two. Its like fitting a square in a triangle shaped hole!

Can Anyone shed any light on how these two browsers, (also maybe inc Opera) load pages differently, and any standards they comply with? please
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old May 18th, 2005, 08:09
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
try making a copy of your page, and removing div's one by one until you work out which one is causing the problem, then post back here with your specific problem.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old May 18th, 2005, 08:15
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
Try not using absolute/relative positioning, but using floats instead. Much easier and less likely to fall apart x-browser.

I've found in the past that a lot of the cross-browser problem stem from the varying 'default' CSS values applied by each browser. This is most commonly seen in margins and padding (IE already has a poor interpretation of the 'box' model) If you set the margin and padding to zero for problem elements and then set them again, the browser is forced to honour the style sheet values, resulting in a more consitent layout across browsers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old May 18th, 2005, 12:36
Reputable Member
Join Date: May 2005
Location: Sheffield
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Ok thanks.

I was using a div id="container" to contain all the design.

The problem was with div tags using z-index. I placed these within the container div.

Also set all blank fields, margin, padding etc . . to '0' which seamed to give them both a spanking and behave themselves!

::

Another thing : What is the best way to centre align my design in Mozilla Firefox?

I have a css defined for <body> with the text align set to centre and middle, which does it for IE.
But Firefox is to Left. So ive put in 12% L and 10% R in the margins. This looks ok but could be more accurate maybe?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old May 18th, 2005, 13:31
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
I usually have a div inside the BODY tags with an id="page" then I'll style as follows:

Code: Select all
<body>
<div id="page">

...

</div>
</body>

Code: Select all
BODY { 
 text-align: center /* ie centering fix */
}

#page {
 width: 760px
 margin: auto;
 text-align: left /* ie centering fix */
}
...then everything else goes inside the page DIV.

The BODY tag needs to be text-aligned to center to get the #page DIV to move to the center in Internet Explorer. Content inside the page DIV is then aligned to left again.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #6  
Old May 18th, 2005, 14:06
Reputable Member
Join Date: May 2005
Location: Sheffield
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for that. Works Ok.

Columns. How can I do these without a table? Need 2 colums. Been using float left/right but the <divs> stack up.

Ive tried having one contained within another but the text pushes the contained one down
Im trying to get two Divs next to each other, or am I going about this wrong?

::AK
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #7  
Old May 18th, 2005, 17:46
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
to float 2 divs side-by-side simply set the width of each one so that the total is slightly less that the width of the page and set the first DIV to float:left. the other one should jump up to the right hand side. If it doesn't then set the widths on each a bit smaller till it does. Remember that the total width will also include 2 x any margin that you have on the divs.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #8  
Old May 21st, 2005, 07:02
Junior Member
Join Date: May 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
i have the following style sheet:
Code: Select all
body {
	text-align: center;
	background: #2E2E2E;
	margin: 0;
	padding: 0;
}

#page {
	width: 700px;
	text-align: left;
	background: #FFFFFF;
	}
and the XHTML document:
Code: Select all
<body>
<div id="page"></div>
</body>
What i want to do is to align the page to the center. In IE my code works, but in firefox the page is aligned to the left. Why is that?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #9  
Old May 21st, 2005, 07:07
Junior Member
Join Date: May 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
if i add
Code: Select all
margin: 0px auto;
to my "page" style, the page appears corectly in firefox. Is it because i've set the left and right margins to auto?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #10  
Old May 21st, 2005, 12:32
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
yup. Also, if your setting something as 0 (zero) then you don't need the units after it, so:

0px

is the same as:

0
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
css, firefox, driving, nuts

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 Issue (in Firefox only)... probably simple but its driving me crazy! alfandango Web Page Design 4 Mar 8th, 2008 17:11
centering is driving me nuts! mykl Web Page Design 9 Oct 25th, 2007 12:13
This is driving me nuts! Please Help! dm2757 Flash & Multimedia Forum 1 Aug 22nd, 2007 21:30


All times are GMT. The time now is 07:52.


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