Which of the following property sets the style of a font?

font
style
font-style
@font-face

The correct answer is: C. font-style

The font-style property sets the style of a font. It can be used to specify the font’s weight, italic, and obliqueness.

The font property is used to specify the font family, size, and color of text.

The style property is used to specify the overall style of an element, such as its font family, size, color, and alignment.

The @font-face rule is used to define a custom font that can be used in a document.

Here is an example of how to use the font-style property:

css
p {
font-style: italic;
}

This will make all paragraphs in the document italic.

Here is an example of how to use the font property:

css
p {
font-family: Arial, sans-serif;
font-size: 16px;
color: black;
}

This will make all paragraphs in the document use the Arial font, with a size of 16px and a color of black.

Here is an example of how to use the style property:

css
p {
style: font-family: Arial, sans-serif;
font-size: 16px;
color: black;
}

This is the same as the previous example, but it uses the style property instead of the font property.

Here is an example of how to use the @font-face rule:

“`css
@font-face {
font-family: MyFont;
src: url(myfont.ttf);
font-weight: normal;
font-style: normal;
}

p {
font-family: MyFont;
}
“`

This will define a custom font called MyFont that can be used in the document. The font will be loaded from the file myfont.ttf. The font will have a normal weight and style.

Exit mobile version