CSS to change font

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JCO

    #1

    CSS to change font

    How would you modify this to include font color to be white:
    <style type="text/css">ul,ol{colo r:white;}</style>

    I tried this, but it did not work:
    <style type="text/css">font color="#FFFFFF" ,ul,ol{color:wh ite;}</style>


  • Michael Winter

    #2
    Re: CSS to change font

    On Tue, 02 Mar 2004 14:02:10 GMT, JCO <J.Oliviero@ver izon.net> wrote:
    [color=blue]
    > How would you modify this to include font color to be white:
    > <style type="text/css">ul,ol{colo r:white;}</style>[/color]

    CSS is off-topic in this group. Please refer style sheet questions to
    comp.infosystem s.www.authoring.stylesheets in the future.
    [color=blue]
    > I tried this, but it did not work:
    > <style type="text/css">font color="#FFFFFF" ,ul,ol{color:wh ite;}</style>[/color]

    That's because it's an invalid selector. Read the specification regarding
    selectors:
    http://www.w3.org/TR/REC-CSS2/selector.html

    If you're using CSS, why are you bothering with deprecated elements like
    FONT, anyway?

    Your solution would either be to use a styled SPAN element to surround
    highlighted text (which I assume is your goal):

    span.white, ul, ol {
    /*
    Make sure that an explicit background-color property
    is specified here or in an ancestor.
    */
    color: #ffffff;
    }
    ...
    <p>Some <span class="white">w hite</span> text</p>

    ....or to match the color attribute value in the font element:

    font[color="#ffffff"], ul, ol {
    color: #ffffff;
    }

    The latter won't work in IE, due to its abysmal CSS 2 support, though it
    will render the font element. The first solution is obviously preferred.

    Mike

    --
    Michael Winter
    M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: CSS to change font

      JCO wrote:
      [color=blue]
      > How would you modify this to include font color to be white:
      > <style type="text/css">ul,ol{colo r:white;}</style>
      >
      > I tried this, but it did not work:
      > <style type="text/css">font color="#FFFFFF" ,ul,ol{color:wh ite;}</style>[/color]

      No wonder it is not working, since it is invalid CSS at best:

      <http://jigsaw.w3.org/css-validator/>

      You are looking for either

      body, ul, ol {
      color:white;
      }

      or

      * {
      color:white;
      }

      (to format all elements) and comp.infosystem s.www.authoring.stylesheets
      where all this is on-topic.

      Be sure to specify a proper background-color, too:
      <http://www.w3.org/QA/Tips/color>


      X-Post & F'up2 ciwas

      PointedEars

      Comment

      Working...