SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    somewhere over the rainbow
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question how to change the colour of the font is inside <ol> ....?

    It was stablished on a css that < li > would be orange colour :

    { list-style-type: none; color: #F29900; margin: 0 0 0px 0;padding: 0 0 0 0px;}
    a little bit later I made up my mind to work on a form which employs <ol> :

    <fieldset><ol><li><label for="xxx">xxx /label>
    <input type="text" name="xxx" id="xxx" class="text"/> </li>
    then it became necessary to change the colour of the text which appears in front of the form fields ;

    I tried to do the following :

    ol {font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #000000; }
    The font format was changed , however the colour stubbornly remains #F29900 (as it is inside <li> tags ;

    what do I have to do to change the colour ?
    thank you

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Write a more specific rule: ol li { ... }

  3. #3
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep.

    The reason the color isn't changing is because of the adjacency rule. "li" and "ol" have the same degree of specificity, so the one that is closer wins (li is closer than ol).

    Dan's solution is one approach. Another would be to switch the li selector for "ul", which would achieve the same end, but would also mean that only li's inside a ul would get the color (don't know what the rest of your site needs so don't know if that's the right way to go).

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    somewhere over the rainbow
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much for yor explanation


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
  •