Help with CSS syntax please

Discussion in 'CSS' started by JustAnotherDude, Jul 4, 2009.

  1. #1
    I'm just starting with CSS. In looking at many online examples to see how things are being done in the real world, from time to time I see a syntax that I can't find in my books, nor at the various CSS sites. For example...

    body>#content-wrapper {margin-left:0;}

    What is the ">#" in that line?

    Also, recommendations for better books and/or online tutorials appreciated. Thanks very much.
     
    JustAnotherDude, Jul 4, 2009 IP
  2. Enmar

    Enmar Active Member

    Messages:
    177
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Not 100% sure but I think that the ">" is just there for no reason...

    I'd assume that it would function the same as:

    body #content-wrapper {
    margin-left: 0;
    }

    Simply the rules for the item with the id "content-wrapper" inside the <body> tags.
     
    Enmar, Jul 4, 2009 IP
  3. justinlorder

    justinlorder Peon

    Messages:
    4,160
    Likes Received:
    61
    Best Answers:
    0
    Trophy Points:
    0
    #3
    There should be no such code like ">#" .
    Anyway, in css , "#" is before the id name of an element.
    "." is before the class name of an elememt.
     
    justinlorder, Jul 5, 2009 IP
  4. ira123

    ira123 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    body #content-wrapper {
    margin-left: 0;
    margin-right:0;
    }
     
    ira123, Jul 6, 2009 IP
  5. qazu

    qazu Well-Known Member

    Messages:
    1,834
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    165
    #5
    The # bit indicates that the selector or element (probably a div in this case) named content-wrapper is using an id and not a class - #content-wrapper for id="content-wrapper" and .content-wrapper for class="content-wrapper".

    The > indicates that its a child selector
     
    qazu, Jul 6, 2009 IP
  6. Domster

    Domster Greenhorn

    Messages:
    34
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #6
    Check if there is another call for #content-wrapper. It is possible the designer used an IE CSS hack by using the child '>' selector.
     
    Domster, Jul 7, 2009 IP