Need help? Check out our Support site, then

Question about the symbols in CSS

  1. Greets:

    Silly question about CSS. I'm looking at a CSS file and am wondering when you use the # marks, when you use the periods and when you don't use anything at all in front of the lines.


    Told you I didn't know anything about CSS :)

  2. # = id
    An id can only be used once.

    . = class
    You can use classes as often as you need and in different ways

    [blank] = just a regular declaration


    #box {-details-}
    <div id="box">
    You can only have one such box used once on a page.

    .text2 {-details-}
    <div class="text2">This could be used here</div>
    then we have some other text
    <div class="text2">and we use that styling again here</div>

    h3 {font-size: 10px;}

    .bigger {font-size: 20px;}

    You can mix though ..

    <h3>This will be 10px tall</h3>
    <h3 class="bigger">and this would be 20px</h3>

    or you could have

    .red {color:#ff0000;}
    .green {color:#00ff00;}
    .blue {color:#0000ff;}
    and then do
    <p class="red"> Have some red <p class="blue"> and some blue etc...

  3. Some formatting above is screwed - and I'm sure someone else will explain better :)

  4. That actually makes sense to me. Thanks. I owe you one. I always wondered about that.

Topic Closed

This topic has been closed to new replies.

About this Topic