hr needs to be styled differently in tables. (different color)

Discussion in 'CSS' started by RogerDodgr, Jul 8, 2009.

  1. #1
    This is the existing code for the hr tags in my CSS style sheet.
    
    hr
    {
      margin:0;
      padding:0;
      border:none;
      height:1px;
      background:#5294c1;
    }
    
    Code (markup):
    I want the hr tags to be styled differently inside of a table. This is what I tried, but it does not work:
    
    table.hr{
    background:#333;
    }
    
    Code (markup):
    How can I style the hr tags differently when they're inside a table?

    I can style each tag individually inside the HTML, but that is not a good solution.


    .
     
    RogerDodgr, Jul 8, 2009 IP
  2. i.run.shit

    i.run.shit Peon

    Messages:
    61
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    table.hr{
    background:#333;
    }
    Code (markup):
    is wrong because you put a period in between table and hr. You only put a period when defining a class. Just try and see how it works for you..

    table hr{
    background:#333;
    }
    Code (markup):
     
    i.run.shit, Jul 8, 2009 IP
    RogerDodgr likes this.
  3. RogerDodgr

    RogerDodgr Well-Known Member

    Messages:
    267
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #3
    It worked i.run.shit, rep added
     
    RogerDodgr, Jul 8, 2009 IP