Results 1 to 2 of 2

Thread: Making <th> align right only on one <th>

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Making <th> align right only on one <th>

    How can I make the <th> on the right hand side align everything inside it to the right? I already have a class which applies to all my <th>

    HTML Code:
      <thead>
      <tr>
        <th scope="col" class="twentyfive">STATUS</th>
        <th scope="col" class="twentyfive">VIEW</th>
        <th scope="col" class="twentyfive">DOWNLOAD</th>
        <th scope="col" class="twentyfive">TOTAL</th>
      </tr>
      </thead>
    Do I need to add something like this?

    [css]
    table.main thead tr th.twentyfive {
    /*border: 1px solid #fff;*/
    width: 25%;
    }
    table.main thead tr th.twentyfive.right {
    /*border: 1px solid #fff;*/
    width: 25%;
    float: right;
    }[/css]

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You really want to use the :first-child pseudoclass:
    Code:
    thead tr:first-child {
      text-align: right;
    }
    Unfortunately, IE (6 at least) doesn't support this pseudoclass, so you have to assign it a new class:
    Code:
    table.main thead tr th.first-twentyfive {
      text-align: right;
    }
    Code:
    <thead>
      <tr>
        <th scope="col" class="twentyfive">STATUS</th>
        <th scope="col" class="twentyfive">VIEW</th>
        <th scope="col" class="twentyfive">DOWNLOAD</th>
        <th scope="col" class="twentyfive">TOTAL</th>
      </tr>
    </thead>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •