To dot or not to dot?

Discussion in 'HTML' started by Samuël van Laere, Oct 16, 2003.

  1. I've seen both methods used:

    #something .label {
    color: #000;
    }

    and

    #something label {
    color: #000;
    }

    Or are both acceptable?
    Or should i use one in particular?


    --
    With regards,
    Samuël van Laere
    the Netherlands
    Samuël van Laere, Oct 16, 2003
    #1
    1. Advertising

  2. Samuël van Laere

    Adrienne Guest

    Gazing into my crystal ball I observed "Samuël van Laere"
    <> writing in news:FVljb.259741$lh.58243572
    @amsnews02.chello.com:

    > I've seen both methods used:
    >
    > #something .label {
    > color: #000;
    > }
    >
    > and
    >
    > #something label {
    > color: #000;
    > }
    >
    > Or are both acceptable?
    > Or should i use one in particular?
    >
    >
    > --
    > With regards,
    > Samuël van Laere
    > the Netherlands
    >
    >
    >


    # indicates an id, . indicates a class, (nothing) indicates an element.

    --
    Adrienne Boswell
    Please respond to the group so others can share
    http://www.arbpen.com
    Adrienne, Oct 16, 2003
    #2
    1. Advertising

  3. "Adrienne" <> schreef in bericht
    news:Xns9415B914A3CEarbpenyahoocom@207.115.63.158...
    > Gazing into my crystal ball I observed "Samuël van Laere"
    > <> writing in news:FVljb.259741$lh.58243572
    > @amsnews02.chello.com:
    >


    # indicates an id, . indicates a class, (nothing) indicates an element.
    >
    > --
    > Adrienne Boswell
    > Please respond to the group so others can share
    > http://www.arbpen.com


    Ok so:

    #something .label {
    color: #000;
    }

    is an ID despite of the dot before the 'label' ?
    If that is so then a dot isn't needed.
    The validator doesn't seem to care either,
    so what ever i use it seems to be correct anyway.


    Thanks for the information Adrienne.


    --
    With regards,
    Samuël van Laere
    the Netherlands
    Samuël van Laere, Oct 16, 2003
    #3
  4. Samuël van Laere

    Richard Guest

    Samuël van Laere wrote:

    > I've seen both methods used:


    > #something .label {
    > color: #000;
    > }


    > and


    > #something label {
    > color: #000;
    > }


    > Or are both acceptable?
    > Or should i use one in particular?


    The way I see it, they were given as methods to be employed as a users
    choice.
    While some will argue the point that only 1 # should be used.
    Well duh, if it saves space to say "id" rather than "class", would you print
    out your name as "mister" rather than "mr."?
    If the system supports more than one ID, then by all means, use it.
    Richard, Oct 16, 2003
    #4
  5. Samuël van Laere

    Mark Parnell Guest

    Sometime around Thu, 16 Oct 2003 02:16:05 GMT, Samuël van Laere is reported
    to have stated:
    >
    > Ok so:
    >
    > #something .label {
    > color: #000;
    > }
    >
    > is an ID despite of the dot before the 'label' ?


    No. <pedantic>It is a style rule</pedantic>. :) It means apply this
    rule to any element with class="label" that is a child of an element with
    id="something".

    > If that is so then a dot isn't needed.


    It depends whether you are trying to apply the rule to an element with
    class="label" or a label element.

    > The validator doesn't seem to care either,


    Both are valid, so it shouldn't.

    > so what ever i use it seems to be correct anyway.


    Valid, yes. Correct no. As above, it depends what you are trying to do.
    (Of course, if you have <label...class="label"> then either will work, but
    that would seem a little pointless).

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
    Mark Parnell, Oct 16, 2003
    #5
  6. Richard wrote:

    > If the system supports more than one ID, then by all means, use it.


    Yes, then you notice that your browser isn't the only one in the world.
    Leif K-Brooks, Oct 16, 2003
    #6
  7. Samuël van Laere

    Richard Guest

    Samuël van Laere wrote:


    > "Adrienne" <> schreef in bericht
    > news:Xns9415B914A3CEarbpenyahoocom@207.115.63.158...
    >> Gazing into my crystal ball I observed "Samuël van Laere"
    >> <> writing in news:FVljb.259741$lh.58243572
    >> @amsnews02.chello.com:



    > # indicates an id, . indicates a class, (nothing) indicates an
    > element.


    >> --
    >> Adrienne Boswell
    >> Please respond to the group so others can share
    >> http://www.arbpen.com


    > Ok so:


    > #something .label {
    > color: #000;
    > }


    > is an ID despite of the dot before the 'label' ?
    > If that is so then a dot isn't needed.
    > The validator doesn't seem to care either,
    > so what ever i use it seems to be correct anyway.



    > Thanks for the information Adrienne.


    #something label{}
    No dot needed.
    In actuality, it shoul read something like div#label{}.
    Meaning, ID "label" is used primarily in <div> tags.
    <div id="label">
    Would be valid whereas, <table id="label"> could be invalid.
    Richard, Oct 16, 2003
    #7
  8. Both mean different things...

    Samuël van Laere wrote:

    > #something .label {
    > color: #000;
    > }


    This would match:

    <div id="something">
    <p><em class="label">Hello</em></p>
    </div>

    or

    <div id="something">
    <p class="label">Hello</p>
    </div>

    That is, it matches elements with class="label".

    > #something label {
    > color: #000;
    > }


    This would match:

    <p id="something">
    <label for="foobar">Name</label>
    </p>

    That is, it matches <label> elements.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?id=132
    Toby A Inkster, Oct 16, 2003
    #8
  9. Thanks for the explanation people now i know
    what the difference is and how to use it.


    --
    With regards,
    Samuël van Laere
    the Netherlands
    Samuël van Laere, Oct 16, 2003
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christopher M. Lusardi

    volatile struct in dot h vs dot c

    Christopher M. Lusardi, May 11, 2004, in forum: C Programming
    Replies:
    3
    Views:
    472
    Peter Shaggy Haywood
    May 15, 2004
  2. Nathan Sokalski
    Replies:
    11
    Views:
    701
    AAaron123
    Aug 14, 2009
  3. krishnan

    Dot Net Project Execution without Dot Net and Framework....

    krishnan, Jan 7, 2006, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    184
    krishnan
    Jan 7, 2006
  4. Pen Ttt
    Replies:
    4
    Views:
    142
    Pen Ttt
    Sep 24, 2010
  5. Replies:
    6
    Views:
    242
    Thomas 'PointedEars' Lahn
    Dec 12, 2005
Loading...

Share This Page