opu 웃
opu 웃

Reputation: 462

Why italic font is not working

I am learning CSS. I tried to make some text italic. But the text are not going italic. Where is the problem?

.bold {
  font-weight: bold;
}

.italic {
  font-weight: italic;
}
<p>This is some text</p>

<p class="bold">This is some bold text</p>

<p class="italic">This is some italic text</p>

Upvotes: 5

Views: 11747

Answers (6)

Rakshit Shah
Rakshit Shah

Reputation: 438

You Have Given Wrong Property for ITALIC,Try This property and give same value

.italic{
font-style:italic;
}

Upvotes: 3

Jacob G
Jacob G

Reputation: 14172

italic is a font-style property, not font weight:

.italic{
font-style:italic;
}

Upvotes: 3

freefaller
freefaller

Reputation: 19963

You can't set italics using a CSS command called font-weight.

Try using font-style: italic instead.

.bold {
  font-weight: bold;
}

.italic {
  font-style: italic;
}
<p>This is some text</p>

<p class="bold">This is some bold text</p>

<p class="italic">This is some italic text</p>

Upvotes: 13

Frontend_87
Frontend_87

Reputation: 75

that's wrong

try this:

.italic{font-style:italic;}

Upvotes: 2

Adam Benedek
Adam Benedek

Reputation: 592

Use font-style: italic; instead.

font-weight is responsible for boldness, and uses number (100, 200, 300,..., 900) to set it; "bold" is just a special value there.

Upvotes: 3

Quentin
Quentin

Reputation: 944445

Italic isn't a font weight (which determines how bold the text is). It's a font-style

Upvotes: 3

Related Questions