Margin-top problem ith firefox

Discussion in 'CSS' started by Om ji Kesharwani, Oct 23, 2009.

  1. #1
    I have a problem with firefox
    when i set <body style="margin-top: 0px"> it works fine with explorer but in case of firefox it does not set margin 0px from the top.
    Is there any other option for firefox?
     
    Om ji Kesharwani, Oct 23, 2009 IP
  2. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #2
    The problem isn't with Firefox, it's with your markup.

    Post your markup, including your CSS, so that we can have a look.
     
    Masterful, Oct 23, 2009 IP
  3. MhW

    MhW Active Member

    Messages:
    370
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    85
    #3
    It could be because you're missing the semi-colon, although I've just made a quick test and on modern browsers it doesn't seem to have any difference.
    Anyway, Inline CSS is horrible. You should just add the following to your stylesheet:
    body {
       margin: 0;
    }
    Code (markup):
     
    MhW, Oct 23, 2009 IP
  4. Om ji Kesharwani

    Om ji Kesharwani Peon

    Messages:
    211
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    There is only one property so its not the matter of semi-colon?
    Anyway thanks for all replies.
    I found the mistake.
     
    Om ji Kesharwani, Oct 23, 2009 IP
  5. Love*

    Love* Well-Known Member

    Messages:
    1,739
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    165
    Digital Goods:
    1
    #5
    The semi-colon only applies if it's being followed by another property.. e.g. <body style="margin-top: 0px; background: black">
     
    Love*, Oct 23, 2009 IP
  6. MhW

    MhW Active Member

    Messages:
    370
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    85
    #6
    Intriguing. Been freelancing for a little over 2 years always thought an inline style always had to be accompanied with a semi-colon.

    Cheers pal :)
     
    MhW, Oct 23, 2009 IP
  7. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Quite like PHP then which will also always execute it's last statement without a semi-colon!
    
    <?php echo "my text" ?>
    PHP:
     
    wd_2k6, Oct 23, 2009 IP