Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Colour a hr tag

Discussion in 'Website Coding & Programming Forum:' started by paul_hutton, Oct 17, 2011.

  1. paul_hutton

    paul_hutton Member

    Need a little help with a hr tag, I have tried to colour the background but I can't seem to find the right code can anyone help?
     
  2. Paul Murray

    Paul Murray Moderator Staff Member

    I believe it takes it's colour from the 'color' tag.


    hr {
    color:#000;
    }

    You can also use the background color tag too

    hr {
    background-color:#000;
    }

    If it's not changing color it may be inheriting it's color from the somewhere else. Adding !important before the semi colon should override it.

    hr {
    color:#000!important;
    }
     
  3. paul_hutton

    paul_hutton Member

    What a boob I didn't think of looking in the current CSS, cheers for that I will have a look and see what's what. thanks for the quick response
     
  4. Corrosive

    Corrosive Moderator Staff Member

    Actually, color will change the text color only. You want to use background-color for that. Also 'color' isn't a tag it is a CSS attribute. It is important not to confuse matters. Tags are HTML.

    Sorry to be a nerd :icon_wink:
     
  5. Paul Murray

    Paul Murray Moderator Staff Member

    You know what I mean :icon_smile:
     
  6. paul_hutton

    paul_hutton Member

    I knew what you were saying, got that all sorted now thank you, I didn't realise someone had already specified a colour for hr in the css.
     
  7. Edge

    Edge Active Member

    Aside: It's usually better to make your css selector's more specific than use !important as it get's to be a bad habit. I'd only use it when overwriting an inline style that some plugin javascript has chucked in.
     
  8. paul_hutton

    paul_hutton Member

    I don't want to be over writing anything especially when the code is already there, I want to keep everything as simple and as neat as possible
     

Share This Page