SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    Non-Member
    Join Date
    Jan 2003
    Posts
    866
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .body (newbie alert!)

    shouldn't a style that looks like this:

    .body {
    font-family:Verdana, Geneva, Arial;
    font-size:11px;
    color:000000;
    line-height:11px;
    text-decoration:none;
    }

    apply this style to everything within the body tags that doesn't have an over-riding style? How can I specify a style that applies to everything in a page?

    Thanks!

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, not "everything within the body tags", everything with the attribute class="body"
    Remove the . in .body

  3. #3
    Ceci n'est pas Zoef Zoef's Avatar
    Join Date
    Nov 2002
    Location
    Malta
    Posts
    1,111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a dot to many!

    Make it body {...

    This will make the rule aply to the body element and all its descendants (this is called 'inheritance') except, like you pointed out, where overriding styles apply. Also take note that NN4.X (if you want to support this dinasour) has very iffy support for inheritance. In that case you might want to do something like this:
    body, div, p, td, li {....

    .body as a selector means the rule will apply to any element in the document with the class body (<p class="body"> <span class="body"> etc... )

    Rik
    English tea - Italian coffee - Maltese wine - Belgian beer - French Cognac

  4. #4
    Non-Member
    Join Date
    Jan 2003
    Posts
    866
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Zoef
    Just a dot to many!

    Make it body {...

    This will make the rule aply to the body element and all its descendants (this is called 'inheritance') except, like you pointed out, where overriding styles apply. Also take note that NN4.X (if you want to support this dinasour) has very iffy support for inheritance. In that case you might want to do something like this:
    body, div, p, td, li {....

    .body as a selector means the rule will apply to any element in the document with the class body (<p class="body"> <span class="body"> etc... )

    Rik
    Cool thanks

  5. #5
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    p.s.

    add a 'hash' symbol (#) to your hexdec colour value

    Code:
    color:#000000;
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  6. #6
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ...and lose a coupla 0s ...

    Code:
    color:#000;
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  7. #7
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by TheOriginalH
    ...and lose a coupla 0s ...
    Code:
    color:#000;
    [img]images/smilies/wink.gif[/img]
    I've always wondered this. Why is it better to use 3 digits instead of 6? Wouldn't 6 be better to be more consistant since most colors contain 6 digits?

    If this is better, is it only done when all 6 digits are the same?
    John Saunders

  8. #8
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it's just a short hand since "web Safe" (since when is anything safe on the web) colors also has two of the same characters "ffcc00".
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  9. #9
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that, and it's 3 less un-compressed bytes to send to the user.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •