Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why italic font is not working

Tags:

html

css

fonts

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>
like image 980
opu 웃 Avatar asked Nov 27 '22 16:11

opu 웃


1 Answers

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>
like image 117
freefaller Avatar answered Dec 04 '22 11:12

freefaller