tags:

views:

301

answers:

5

Is there something wrong with firefox? My styles on <label> work in every browser but FF. I'm using 3.5.5. I mean they even work in every version of IE? anyone have a suggestion?

EDIT, as i said, the code works in any other browser. but all of these fails.

<label style="color: #aaa; font-weight: bold;">Blah</label>

and

.mylabel {
color: #aaa; 
font-weight: bold;
}

<label class="mylabel">Blah</label>

and

label {
color: #aaa; 
font-weight: bold;
}

<label>Blah</label>

There you go. Where's the error in code? i sure don't see one.

+2  A: 

The most probable reason is there are some other styles that are overriding these. The easiest thing you can do here is:

  1. Download firebug: http://getfirebug.com/ and install it.

  2. Open up firebug, click the second button on the top left (the one that looks like an arrow pointing to a button) and then click on your label. On the right side you will see what styles are being applied to it and which are being overwritten.

As a general rule, it's a good idea to post all relevant information / code about your question. The users of SO are not wizards; if you couldn't figure out the problem with the code in front of you, there's a slim chance anyone will figure out the problem with no code. Try to put yourself in their shoes – would you be able to figure out a technical issue that just says "something is wrong with my code"? Most likely, you're going to get downvoted without getting a proper response.

Goose Bumper
there are no other styles for label... even the inline styles simply do not work in firefox. works in all other browsers though...
mike
post your code and stop complaining about downvotes. if you don't want downvotes, write your question as a intelligent person would do - use the offered styling above the text box.
dusoft
why was my message deleted.? lol. doo doo baby!
mike
A: 

Also ensure that you don't render in quirks mode but in standards mode. Usually the styles which doesn't work in FF but do in IE is after all IE's fault because it's either too forgiving or rendering in quirksmode.

Read this for more info: http://hsivonen.iki.fi/doctype/

To the point: use a strict doctype and develop in FF.

BalusC
+4  A: 

This sounds odd. I'm quite sure something must be wrong with the markup (Like a tag not closed somewhere).

Could this be?

Does the document validate?

Can you post a link to the whole page?

Pekka
+1  A: 

Renders fine in FireFox 3.5.5, both with an XHTML transitional DOCTYPE and no DOCTYPE.

What environment are you testing this in... Is it local or a remote server? If you go to the View menu and view the source for the page via FireFox, do the inline styles appear correctly? Could you be looking at a cached copy of the page?

Another worthwhile alternative is to start from scratch. Create a minimal page with just a label and the CSS to color it. Add features of the broken page until you reach the point where the problem occurs.

AaronSieb
"Another worthwhile alternative is to start from scratch. Create a minimal page with just a label and the CSS to color it. Add features of the broken page until you reach the point where the problem occurs."This is a good idea in general, regardless of project type / language.
Goose Bumper
A: 

As others have pointed out, works fine for me. Maybe you can try the following code to narrow down the problem:

<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<style type="text/css">
    .mylabel {
        color: #aaa; 
        font-weight: bold;
    }
</style>
</head>
<body>
<form>
    <label class="mylabel" for="f1">Field 1</label>
    <input id="f1" type="text">
    <label style="color: #aaa;font-weight:bold" for="f2">Field 
        2</label>
    <input id="f2" type="text">
    <input type="submit">
</form>
</body>
</html>
Sinan Ünür