www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] Applying TD style to a specific table class

  1. #1
    Join Date
    Jul 2007
    Posts
    31

    resolved [RESOLVED] Applying TD style to a specific table class

    I have a set of CSS elements for all tables across my web app like so:

    PHP Code:
    TDP
    {
        
    FONT-SIZE8pt;
        
    COLOR#000;
        
    FONT-FAMILYArialHelveticasans serif;
    }
    TH {
      
    border-top1px solid #ccc;
      
    border1px solid #ccc;
      
    border-bottom1px solid #ccc;
      
    color#efefef;
      
    background#011d4b url(../images/th_background.gif) repeat-x;
      
    text-aligncenter
      
    font-size85%;

    But I have a specific class for data output tables which contains additional styling (for use with a .js alternating row color), like so:

    PHP Code:
    .dataTable
    {
        
    margin-top0.5em;
        
    border1px solid #DDD;
        
    border-collapsecollapse;
        
    border-spacing1px;   

    I need to add additional TD elements to just tables using the dataTable class, so that I can have borders between the columns.

    Was trying something like this, but I can't get the syntax to work:

    PHP Code:
    td.dataTable
    {
        
    border1px dotted #DDD;

    Hoping someone can help me with what should be a simple thing. Thanks.

  2. #2
    Join Date
    Aug 2007
    Posts
    3,767
    Code:
    td.dataTable
    {
        border: 1px dotted #DDD !important;
    }
    What exactly isn't working?

  3. #3
    Join Date
    Jul 2007
    Posts
    31
    td.dataTable
    {
    border: 1px dotted #DDD !important;
    }
    That's not working.

    My goal is to create a border for all cells only in tables with class="dataTable". I don't want TD borders anywhere else in any other tables.

  4. #4
    Join Date
    Nov 2002
    Posts
    4,473
    td.dataTable
    would apply the style to a TD with a class named "dataTable". If you want a TD inside the TABLE with the class "dataTable", you would need to declare this instead:
    Code:
    .dataTable td

  5. #5
    Join Date
    Jul 2007
    Posts
    31
    Code:
    .dataTable td
    Perfect, thank you. That makes sense. datatable.td would have required the class be called inside each td tag.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles