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>
      

Run codeHide result


+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>
      

Run codeHide result


+11


source


You gave the wrong property for ITALY . Try this property and specify the same value



.italic{
font-style:italic;
}

      

+4


source


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

+3


source


Use font-style: italic;

instead.

font-weight

is responsible for courage and uses the number (100, 200, 300, ..., 900) to set it; "bold" is only a special value.

+3


source


italic

is a property font-style

, not a font weight:

.italic{
font-style:italic;
}

      

+3


source


what's wrong

try this:

.italic{font-style:italic;}

      

+2


source







All Articles