Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

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

Question posted by: r_ahimsa_m@poczta.onet.pl (Guest) on June 27th, 2008 07:19 PM
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's Avatar
Ed Mullen
Guest
n/a Posts
June 27th, 2008
07:19 PM
#2

Re: newbie: "text-decoration: italic" doesn't work for h2
Join Bytes! wrote:
Quote:
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/


http://www.w3schools.com/Css/pr_tex...-decoration.asp

Use font-style: italic; instead.

--
Ed Mullen
http://edmullen.net
A bartender is just a pharmacist with a limited inventory.

Jukka K. Korpela's Avatar
Jukka K. Korpela
Guest
n/a Posts
June 27th, 2008
07:19 PM
#3

Re: newbie: "text-decoration: italic" doesn't work for h2
Scripsit Join Bytes!:
Quote:
I am learning CSS and other WWW technologies.


You clearly need a better tutorial than the one you have read.
Quote:
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")
http://www.cs.tut.fi/~jkorpela/


 
Not the answer you were looking for? Post your question . . .
189,174 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors