SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict frankdux's Avatar
    Join Date
    Apr 2004
    Location
    Ashland, North Carolina
    Posts
    267
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Styling All Cells In One Column

    Does anyone know if there is a way to apply a style to all of the cells(td's) in one column of a table? (without assigning a class to each td in the column). It seems like there should be a way to do this.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Yep. Assign a class to the <col /> element
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
    <title>Untitled</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <style type="text/css">
    <!--
    table {
      background: yellow;
    }
    .hello {
      background: pink;
    }
    -->
    </style>
    
    </head>
    
    <body style="">
    <table>
    <col width="200" class="hello" />
    <col width="100" />
    <col width="100" />
    <col width="150" />
    <tr>
    <td>what</td>
    <td>what</td>
    <td>what</td>
    <td>what</td>
    </tr>
    <tr>
    <td>what</td>
    <td>what</td>
    <td>what</td>
    <td>what</td>
    </tr>
    <tr>
    <td>what</td>
    <td>what</td>
    <td>what</td>
    <td>what</td>
    </tr>
    <tr>
    <td>what</td>
    <td>what</td>
    <td>what</td>
    <td>what</td>
    </tr>
    </table>
    
    </body>
    </html>


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
  •