Question about semicolon AFTER ending brace

Discussion in 'CSS' started by Stormblade, Oct 19, 2006.

  1. #1
    In my html I have a structure like this:

    <div id="div1">
    <div class="div2">
    </div>
    </div>

    Nothing fancy just a nested div with the second one using a class. In my CSS I have some rules for div1 followed by rules for div2 like this:

    div#div1
    {
    margin-left: auto;
    margin-right: auto;
    }

    .div2
    {
    float: left;
    clear: left;
    }

    Now when I use the above I get one set of results. But if I put a semicolon after the closing brace like this:

    div#div1
    {
    margin-left: auto;
    margin-right: auto;
    };

    I get different results. My question is this. What does that do? Why do I get different results that way?
     
    Stormblade, Oct 19, 2006 IP
  2. jascele

    jascele Peon

    Messages:
    48
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think you get different results because your .div2 style isn't getting read when you put the semicolon in. I could be wrong.
     
    jascele, Oct 19, 2006 IP
  3. Zeo

    Zeo Active Member

    Messages:
    158
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Stormblade, it's wrong. Where did u learn that?
     
    Zeo, Oct 19, 2006 IP
  4. Stormblade

    Stormblade Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks. No doubt that's what's happening. I'd accidently put that there trying to fix something else. Did that automatically . The programmer in me.
     
    Stormblade, Oct 20, 2006 IP