form style in IE

Discussion in 'CSS' started by promotingspace.net, Oct 3, 2009.

  1. #1
    Hi
    I used this style in my css:
    input[type=submit]  {
     background-color: #808080;
     color:white;
     font-weight:bold;
    }
    Code (markup):
    It's working in Firefox but not in IE
    Do you know a solution?
    Thanks for your help :p
     
    promotingspace.net, Oct 3, 2009 IP
  2. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #2
    Try putting 'submit' in quotation marks, thus:

    input[type="submit"]  {
    background-color: #808080;
    color:white;
    font-weight:bold;
    }
    Code (markup):
     
    Masterful, Oct 3, 2009 IP
  3. goliath

    goliath Active Member

    Messages:
    308
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Is that some sort of conditional comment syntax, the square brackets?

    As far as I know the best way to do this reliably is to add a class to your inputs.

    < input type="submit" value="this" class="input_submit" >

    then

    .input_submit {
    <style info here>
    }

    This should work properly in every browser with at least CSS 1 parsing.
     
    goliath, Oct 3, 2009 IP
  4. myst_dg

    myst_dg Active Member

    Messages:
    224
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #4
    myst_dg, Oct 4, 2009 IP
  5. goliath

    goliath Active Member

    Messages:
    308
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #5
    goliath, Oct 4, 2009 IP
  6. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #6
    That syntax the OP originally posted:

    -should work with or without the quotes (though I guess the quotes are "more correct")
    -should work in the other modern browsers just fine
    -should work in IE8 (but admittedly I haven't checked using "submit" but I have with type="text")
    -should I think work in IE7... IE7 has partial support for this attribute selector... for instance I can do input[type="text"] and it will work in IE7, but label[for] will not work in IE7 (will work in all the other browsers who understand attribute selectors).
    -shouldn't work at all, ever in IE6 (so if it's something you MUST have, use a class like goliath showed in the example)
     
    Stomme poes, Oct 5, 2009 IP