SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Enthusiast pff's Avatar
    Join Date
    Dec 2000
    Location
    Google PageRank: 6
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Please teach the CSS newbie

    Hello,
    I a few very basic questions about CSS. I'd really appreciate it if you could answer them.

    1) What is the difference between css codes starting with # and with .
    2) What is the difference between using id="xx" and class="xx"
    3) What is the difference between writing it like
    Code:
    .help {  background-color : #fffff0;}
    and
    Code:
    .help {
    background-color: #fffff0;
    }
    4) Should it be
    Code:
    .thtcolor { COLOR: #EEEEFF;}
    or
    Code:
    .thtcolor { COLOR: #EEEEFF}
    Thanks
    pff | I am not what I am

    'Does he exist in the same way as I exist?'
    'You do not exist Winston,' said O'Brien.

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    #'s start ID's
    .'s start CLASS's

    A CLASS is a grouping of elements with the same characteristics/styles.

    An ID is a individual element with a specific characteristic/style.

    Code:
    .help {  background-color : #fffff0;}
    and
    .help {
    background-color: #fffff0;
    }
    are exactly alike.

    Finally, you always end each defined style with a semicolon (.

    Hope this helps.

    sketch
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Enthusiast pff's Avatar
    Join Date
    Dec 2000
    Location
    Google PageRank: 6
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the quick answer, I really appreciate it. But I couldn't get the difference between ids and classes. When should I use an id, when should I use a class?

    Thanks
    pff | I am not what I am

    'Does he exist in the same way as I exist?'
    'You do not exist Winston,' said O'Brien.

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use class to describe MULTIPLE elements...to give them a name such as NavBar or MainPageFooter, etc. That way any element with CLASS="whatever" will carry those styles.

    ID's are identical except there can be only one. So instead of NavBar, you might use NavBar_Selector so that the element carrying that ID would have that style.

    There's no difference really betweent he two except in the case of how many elements can be assigned the CLASS or ID.

    I know that doesn't really answer your question real well. Sorry.

    sketch
    Aaron Brazell
    Technosailor



  5. #5
    SitePoint Enthusiast pff's Avatar
    Join Date
    Dec 2000
    Location
    Google PageRank: 6
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok thanks. I have another question about CSS. I want to be able to specifiy different styles for different links on my page. But I don't want to make it as long as this one:
    Code:
    .forum A:link { text-decoration: none; font-weight: normal; color:#000000; }
    .forum A:visited { text-decoration: none; font-weight: normal; color:#000000; }
    .forum A:active { text-decoration: none; font-weight: normal; color:#000000; }
    .forum A:hover { text-decoration: underline }
    As you see, link, visited and active are the same anyway. How can I write it shorter or what is the ideal way to specifiy different styles for different links.

    Thanks
    Last edited by pff; Oct 31, 2001 at 12:11.
    pff | I am not what I am

    'Does he exist in the same way as I exist?'
    'You do not exist Winston,' said O'Brien.

  6. #6
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cut and paste and then just change the a:____ That's how I'd do it. You could shorthand it, but I recommend against it. I ALWAYS write it all the way out to avoid confusion by browsers or myself for that matter.

    sketch
    Aaron Brazell
    Technosailor




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
  •