SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: CSS question?

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    Indiana
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS question?

    I have a table that has a CSS class named "itemtable" which is applied to a table. If I wanted to apply some formating for text in the "td"'s of that table would it be correct to make a class called "td.itemtable"?
    I have tried this with no results. What could I be doing wrong? Thanks!

  2. #2
    SitePoint Wizard dethfire's Avatar
    Join Date
    Aug 2000
    Posts
    2,477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 4ever
    I have a table that has a CSS class named "itemtable" which is applied to a table. If I wanted to apply some formating for text in the "td"'s of that table would it be correct to make a class called "td.itemtable"?
    I have tried this with no results. What could I be doing wrong? Thanks!
    td .itemtable {

    }


    you need a space between td and .itemtable
    Free Science Homework Help
    http://www.physicsforums.com

  3. #3
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    .itemtable td
    is more correct, since you want td:s that are within an .itemtable thing
    http://www.w3.org/TR/REC-CSS2/select...dant-selectors

  4. #4
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A little example:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
    <html>
      <head>
        <title>CSS Selectors</title>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
        <style type="text/css">
          .itemtable
          {
            background-color: #ff0000;
            color: #ffffff;
            font-family: sans-serif;
          }
          .itemtable td
          {
            background-color: #00ff00;
            color: #000000;
            font-family: serif;
          }
        </style>
      </head>
      <body>
        <table class="itemtable">
          <tr><th colspan="2">This is an "itemtable"</th></tr>
          <tr><td>Hey ho</td><td>Let's go</td></tr>
         </table>
         <table>
          <tr><th colspan="2">This is not an "itemtable"</th></tr>
          <tr><td>Hey ho</td><td>Let's go</td></tr>
         </table>
      </body>
    </html>

  5. #5
    SitePoint Wizard dethfire's Avatar
    Join Date
    Aug 2000
    Posts
    2,477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jofa
    .itemtable td
    is more correct, since you want td:s that are within an .itemtable thing
    http://www.w3.org/TR/REC-CSS2/select...dant-selectors
    good call jofa, I read too fast
    Free Science Homework Help
    http://www.physicsforums.com

  6. #6
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    Indiana
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys!


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
  •