Why cursive font doesn't work
I am learning CSS. I tried to make the text italic. But the text is not in italics. What 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>
+3
source to share
6 answers
You cannot set italic using the CSS command called font-weight
.
Use instead font-style: italic
.
.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>
+11
source to share
Italic is not a weight font (which determines how bold the text is). It's afont-style
+3
source to share
italic
is a property font-style
, not a font weight:
.italic{
font-style:italic;
}
+3
source to share