CSS: "tagname.classname" or ".classname"

Discussion in 'Javascript' started by Ante Perkovic, Dec 22, 2003.

  1. Hi,

    Sorry if this is OT :(

    I have some old CSS files that have all class names preceded with
    tagname, like "TD.verysmall" or "span.important". I'm exeprimenting
    with Dreamwiever and I noticed that, when making new class, DW doesn't
    ask me for which tag it is. I also noticed that classes in some
    template css files don't have tagnames in front.

    So, should I make classes with or without tagnames in front?

    Thanks,
    Ante
     
    Ante Perkovic, Dec 22, 2003
    #1
    1. Advertising

  2. Ante Perkovic wrote:


    > Sorry if this is OT :(


    Try a group on stylesheets if you have a CSS question.

    > I have some old CSS files that have all class names preceded with
    > tagname, like "TD.verysmall" or "span.important". I'm exeprimenting
    > with Dreamwiever and I noticed that, when making new class, DW doesn't
    > ask me for which tag it is. I also noticed that classes in some
    > template css files don't have tagnames in front.
    >
    > So, should I make classes with or without tagnames in front?


    CSS doesn't allow you to "make classes", it allows you to write rules
    with selectors, if you have a selector
    .classname
    then the rule applies to all elements having the class attribute set to
    include that class name e.g to
    <p class="classname">
    as well as
    <span class="classname">
    If you use
    elementname.classname
    e.g.
    p.classname
    then the rule only applies to <p> elements but not <span> elements.
    Which selector to choose depends on your needs.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Dec 22, 2003
    #2
    1. Advertising

  3. Ante Perkovic

    DU Guest

    Ante Perkovic wrote:

    > Hi,
    >
    > Sorry if this is OT :(
    >
    > I have some old CSS files that have all class names preceded with
    > tagname, like "TD.verysmall" or "span.important". I'm exeprimenting
    > with Dreamwiever and I noticed that, when making new class, DW doesn't
    > ask me for which tag it is. I also noticed that classes in some
    > template css files don't have tagnames in front.
    >
    > So, should I make classes with or without tagnames in front?
    >
    > Thanks,
    > Ante


    Maybe I'm a bit off-topic here but you may want to read these because
    they address the question you have:

    "How to write the perfect style sheet - always looks perfect, whatever
    the browser; easy to maintain; quick to download"
    http://richinstyle.com/masterclass/perfection.html
    IMO, unsurpassed and excellent.

    Guidelines for Efficient CSS
    http://www.mozilla.org/xpfe/goodcss.html

    DU
     
    DU, Dec 25, 2003
    #3
    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. Charles A. Lackman

    className Attribute (UserControls)

    Charles A. Lackman, Jul 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    424
    Charles A. Lackman
    Jul 8, 2003
  2. noname

    global.asax classname

    noname, Jul 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    381
    Graham
    Jul 16, 2003
  3. darrel

    Getting parent page classname?

    darrel, Dec 30, 2004, in forum: ASP .Net
    Replies:
    10
    Views:
    506
    John Saunders
    Dec 31, 2004
  4. Oliver S.

    classname::classname a type ?

    Oliver S., Sep 11, 2003, in forum: C++
    Replies:
    1
    Views:
    511
    White Wolf
    Sep 11, 2003
  5. Hongzheng Wang
    Replies:
    32
    Views:
    882
Loading...

Share This Page