style works in one place not another

Discussion in 'HTML & Website Design' started by lektrikpuke, Sep 13, 2007.

  1. #1
    Why does this work when placed in the header:

    <style type="text/css">
    <!--
    body {
    background-color: #000000;
    }
    -->
    </style>

    and not when I have it in a style sheet (also called in the header):

    .body {
    other styles: blah, blah, blah;
    background-color: #000000;
    }

    ?
     
    lektrikpuke, Sep 13, 2007 IP
  2. mikebrad0927

    mikebrad0927 Peon

    Messages:
    266
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    because you are declaring body as a class in your stylesheet. Correct code should be

    body {
    other styles: blah, blah, blah; 
    background-color: #000000;
    }
    
    Code (markup):
    without the .
     
    mikebrad0927, Sep 13, 2007 IP
  3. lektrikpuke

    lektrikpuke Well-Known Member

    Messages:
    297
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    113
    #3
    That worked. Thanks.
     
    lektrikpuke, Sep 13, 2007 IP