newbie: "text-decoration: italic" doesn't work for h2

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • r_ahimsa_m@poczta.onet.pl

    newbie: "text-decoration: italic" doesn't work for h2

    Hello,
    I am learning CSS and other WWW technologies. In the folowing definition
    italic doesn't work:

    h2
    {
    color: Brown;
    text-decoration: italic;
    }

    I mean header is displayed with normal font, not italic.
    I use Firefox and Konqueror in Linux.
    Please help.
    /RAM/
  • Ed Mullen

    #2
    Re: newbie: "text-decoration: italic" doesn't work for h2

    r_ahimsa_m@pocz ta.onet.pl wrote:
    Hello,
    I am learning CSS and other WWW technologies. In the folowing definition
    italic doesn't work:
    >
    h2
    {
    color: Brown;
    text-decoration: italic;
    }
    >
    I mean header is displayed with normal font, not italic.
    I use Firefox and Konqueror in Linux.
    Please help.
    /RAM/


    Use font-style: italic; instead.

    --
    Ed Mullen
    Help for Mozilla, Firefox and SeaMonkey. Performances and original music.

    A bartender is just a pharmacist with a limited inventory.

    Comment

    • Jukka K. Korpela

      #3
      Re: newbie: "text-decoration: italic" doesn't work for h2

      Scripsit r_ahimsa_m@pocz ta.onet.pl:
      I am learning CSS and other WWW technologies.
      You clearly need a better tutorial than the one you have read.
      In the folowing
      definition italic doesn't work:
      >
      h2
      {
      color: Brown;
      text-decoration: italic;
      }
      Of course it does not work, since italic is not an allowed value for
      text-decoration. The checker http://jigsaw.w3.org/css-validator/
      (recommended by _any_ decent tutorial or textbook on CSS these days)
      would have told this immediately.

      Moreover, the checker would have told you that Brown is not a defined
      color value. Though recognized by most browsers, it does not belong to
      any CSS specification. Use numeric color values instead.

      If you fix this and select "More Options" in the checker's user
      interface, then select "All" from the "Warnings" menu - as you should,
      especially if you are a novice, or an advanced CSS author, or a CSS
      guru - then the checker additionally informs you:

      "You have no background-color set (or background-color is set to
      transparent) but you have set a color. Make sure that cascading of
      colors keeps the text reasonably legible."

      The second sentence there is somewhat pointless and obscure. (For
      example, colors don't cascade.) It should read: if you set color for an
      element, set background properties for it, too, and vice versa. (Using
      sufficient color contrast, but that's a different issue.)

      The way to declare that italics be used is
      font-style: italic
      but there are several things to note:
      1) Browsers don't make a distinction between italic and oblique.
      Whichever you declare, you get an italic or oblique version of the font,
      if available, and fake oblique (normal font slanted) otherwise.
      2) Italics should normally be used with serif fonts only, so in
      practice, you should set font-family whenever you set font-style:
      italic.
      3) Italics does not work well with large-size bold text, and headings
      usually appear that way by default.

      --
      Jukka K. Korpela ("Yucca")


      Comment

      Working...