Forum Moderators: not2easy

Message Too Old, No Replies

IE7 vs Firefox - XHTML/CSS

Stuffing up in Firefox

         

Jeigh

12:54 pm on Jan 28, 2007 (gmt 0)

10+ Year Member



When I view my website which I am currently making in IE7 it looks perfectly fine but when I view it in firefox it is stuffed up. I heard there's somthing you can do so different browsers use different rules. I think it's stuffing up because of the size of the text in the navigation in firefox.

Can anyone offer any suggestions or advice? Thanks :)

[edited by: SuzyUK at 1:27 pm (utc) on Jan. 28, 2007]
[edit reason] removed site specifics per TOS #13 [/edit]

penders

4:55 pm on Jan 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I would try and get it working in Firefox first (rather than IE), and then make any adjusts for IE later... for which you can use conditional comments to load a stylesheet specificially for IE (Win) only (and which version 5..7).

Conditional comments only target IE on windows and are ignored by all other browsers.

Conditional comments are HTML and consequently must go in your HTML file, ideally in your <head> section, to override your global stylesheet.

They take the form:

<!--[if gte IE 6]> 
<link rel="stylesheet" type="text/css" href="/css/ie6plus.css" />
<![endif]-->

This delivers the stylesheet "ie6plus.css" to IE greater than or equal to version 6 etc... many variations.

Conditional comments are generally prefered over CSS hacks, as they are far more future proof. CSS Hacks may not work in the next version of a particular browser.

Google for "conditional comments", or Quirksmode has a great article on them:
[quirksmode.org...]

Jeigh

11:41 pm on Jan 28, 2007 (gmt 0)

10+ Year Member



Thanks a lot, I'll do that now.

But do you have any ideas on how to get it working in FF, would it be the text I need to make smaller or somthing?

Edit: Whenever I edit the style sheet and look at it in firefox it dosn't change it for some reason but it changed in IE, why would that be?

It lets me change the links but I can't change the font, font size or the background.

[edited by: Jeigh at 12:06 am (utc) on Jan. 29, 2007]

penders

12:50 am on Jan 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



...any ideas on how to get it working in FF, would it be the text I need to make smaller or somthing?

The text *should* appear about the same size in both FF and IE7 - so long as you are viewing at the browsers 'default' size. ie. not larger/smaller etc.

Whenever I edit the style sheet and look at it in firefox it dosn't change it for some reason but it changed in IE, why would that be?

It sounds as if you *might* have an error in your stylesheet, that is preventing FF from displaying your style. FF is stricter (more correct) than IE. IE can sometimes let you get away with errors in your stylesheet(?) Paste the relevant CSS here and we can check it out...

[edit]
...And I've just noticed SuzyUK's great post on Conditional Comments:
[webmasterworld.com...]
[/edit]

Jeigh

1:16 am on Jan 29, 2007 (gmt 0)

10+ Year Member



/*firefox style*/

<style type="text/css" title="graphics2youstyle" media="screen">
<!--

body {
background-color: #0973bd;
color: #a6a6a6;
font-family: Verdana, Geneva, Arial,
sans-serif;
font-size: 5pt;
line-height: 100%
margin-top: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
}

h1 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

h2 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

h3 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

h4 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

h5 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

h6 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

a:link { color: #2fc800; text-decoration: none }
a:visited { color: #2fc800; text-decoration: none }
a:hover { color: #109ef0; text-decoration: underline }
a:active { color: #109ef0; text-decoration: none }

/*
#adbanner1 {
width:600px;
height:120px;
background: url("banners/adverttest.gif") no-repeat;
} */

-->
</style>

Thats the CSS code there and thanks for that link :)

[edited by: Jeigh at 1:18 am (utc) on Jan. 29, 2007]

Setek

1:58 am on Jan 29, 2007 (gmt 0)

10+ Year Member



body {
background-color: #0973bd;
color: #a6a6a6;
font-family: Verdana, Geneva, Arial,
sans-serif;
font-size: 5pt;
line-height: 100%

margin-top: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
}

(my big)

You need to have a semi-colon after the

line-height
property value - it will error that line and the one below it.

You also have set your font size really, really small. Firefox by default has a minimum font size, defined in the Preferences > Content > Fonts & Colors > Advanced section - which I believe is usually set to 9pt. This is not changeable by author on user machines, so it's just something an author will have to live with (typically, anything so small is illegible, thus inaccessible.) Generally, users on Firefox like the greater control.

Jeigh

2:06 am on Jan 29, 2007 (gmt 0)

10+ Year Member



/*firefox style*/

<style type="text/css" title="graphics2youstyle" media="screen">
<!--

body {
background-color: #0973bd;
color: #a6a6a6;
font-family: Verdana, Geneva, Arial,
sans-serif;
font-size: 12pt;
line-height: 100%;
margin-top: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
}

h1 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

h2 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

h3 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

h4 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

h5 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

h6 {color: #2fc800;
font-family: Verdana, Geneva, Arial,
sans-serif }

a:link { color: #2fc800; text-decoration: none }
a:visited { color: #2fc800; text-decoration: none }
a:hover { color: #109ef0; text-decoration: underline }
a:active { color: #109ef0; text-decoration: none }

/*
#adbanner1 {
width:600px;
height:120px;
background: url("banners/adverttest.gif") no-repeat;
} */

-->
</style>

I changed the bits you said, but there must be more problems aswell =P The font size and everything stays the same no matter what I change it to.

penders

2:07 am on Jan 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



font-size: 5pt; 
line-height: 100%;

You are missing a ';' after your line-height:100% - although that does not seem to be your immediate problem.

It seems that there is a lower limit for the size of fonts in FF?!?! 5pt is very small - approaching the barely readable in IE6 (on my machine). After a little experimentation, it seems that FF's lower limit is 7pt! Any size lower than this renders as 7pt?! (I have not noticed this before - is it dependant on screen resolution!?)

Just to note... 'pt' (point) sizes are really intended for printed media. 'px' (pixels) for screen. But myabe you should consider using a relative dimension such as 'em' that will resize in IE6 and below?
[w3.org...]

[edit]Refering to first code block - seems I was a bit slow on the post[/edit]

Jeigh

2:17 am on Jan 29, 2007 (gmt 0)

10+ Year Member



After fixing the line-heigh I tryed changing the font size as you said but it still dosn't do anything :(

Edit: Here's the top part of the XHTML if it matters :)

<!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>
<link rel="stylesheet" href="g2ustyleff.css" type="text/css" media="screen">
<title>Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body style="margin-top:0px; margin-bottom:0px;">

[edited by: Jeigh at 2:19 am (utc) on Jan. 29, 2007]

penders

2:21 am on Jan 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Are the styles above the only styles you have on your page? (They do seem OK now.)

What DOCTYPE are you using?

Are you able to post a small HTML example?

Setek

2:23 am on Jan 29, 2007 (gmt 0)

10+ Year Member



It seems that there is a lower limit for the size of fonts in FF?!?! 5pt is very small - approaching the barely readable in IE6 (on my machine). After a little experimentation, it seems that FF's lower limit is 7pt! Any size lower than this renders as 7pt?! (I have not noticed this before - is it dependant on screen resolution!?)

Yeah, I mentioned that :)

You also have set your font size really, really small. Firefox by default has a minimum font size, defined in the Preferences > Content > Fonts & Colors > Advanced section - which I believe is usually set to 9pt. This is not changeable by author on user machines, so it's just something an author will have to live with (typically, anything so small is illegible, thus inaccessible.) Generally, users on Firefox like the greater control.

It's not resolution dependent, but it is changeable by the user. My minimum font size is currently 10pt :)

The font size and everything stays the same no matter what I change it to.

Hmm, that's interesting. What element are you looking at when you say it's not changing? Is it a form control (select, textarea, input)?

You'll have to redefine in that case - form controls do not inherit the font properties of its parents.

By the way, you can streamline your CSS a little more by:

  1. Replacing this-
    margin-top: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    margin-right: 0px;

    .. with this-
    margin: 0;

  2. Removing this-
    font-family: Verdana, Geneva, Arial, sans-serif;

    .. from all the headings (h1, h2 .. h6.) The font properties inherit from its parent, the body.
  3. Group your anchor stylings, so instead of-
    a:link { color: #2fc800; text-decoration: none }
    a:visited { color: #2fc800; text-decoration: none }
    a:hover { color: #109ef0; text-decoration: underline }
    a:active { color: #109ef0; text-decoration: none }

    .. you can have this:
    a:link, a:visited { color: #2fc800; text-decoration: none }
    a:hover, a:active { color: #109ef0; text-decoration: none }

penders

2:26 am on Jan 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



(You seem to be posting quicker than I can type! :)

Is your "g2ustyleff.css" external stylesheet exactly as you've posted above? In which case you must not have the <style><!-- --></style> HTML tags in your external CSS file.

Firefox by default has a minimum font size, defined in the Preferences > Content > Fonts & Colors > Advanced section ... My minimum font size is currently 10pt :)

Cheers for that Setek, mine is also set at 10. But I think that must be 10px, as I can set a size of 7pt in FF OK (but not 9px).

[edited by: penders at 2:36 am (utc) on Jan. 29, 2007]

Setek

2:35 am on Jan 29, 2007 (gmt 0)

10+ Year Member



Is your "g2ustyleff.css" external stylesheet exactly as you've posted above? In which case you must not have the <style><!-- --></style> HTML tags in your external CSS file.

Ooh, good point! I never thought of that.

Jeigh, a good tip is to get rid of the small parse errors by validating your (X)HTML and CSS. If your external stylesheet does indeed have HTML elements, the validator should pick up on this and let you know to remove them (and it will pick up the line-height part, and others :D)

HTML Validator:
[validator.w3.org...]

CSS Validator:
[jigsaw.w3.org...]

Jeigh

2:40 am on Jan 29, 2007 (gmt 0)

10+ Year Member



Thanks guys, a lot of helpful information there.

I will try what you said to do with the CSS then validate the XHTML and CSS, I'm sure I will have problems so I will post back here when I do :P

Edit: Haha, It worked! I really wasn't expecting that, everything seems to be working perfectly and suprisingly it works fine in IE aswell without using the if IE thing :P

Thanks again guys.

[edited by: Jeigh at 2:45 am (utc) on Jan. 29, 2007]