font-style
Definition
The font-style CSS property sets the style of the font. It allows you to make text italic, oblique, or normal.
Examples
Make text italic:
font-style: italic;
Make text oblique:
font-style: oblique;
Make text normal:
font-style: normal;
Values
Value | Description |
---|---|
normal | Sets the font style to a normal font face. |
italic | Sets the font style to an italic font face. The italic version of a font is designed to look visually distinct from the normal version, and is often used to emphasize text. |
oblique | Sets the font style to an oblique font face. This is similar to an italic font, but the letters are slanted at an angle rather than being specially designed. Not all fonts have an oblique version, and some that do may not look significantly different from the normal version. |
Best Practices
- Use font-style to emphasize important words or phrases within a block of text.
- Be careful not to use font-style too much, as it can make your text difficult to read.
- Use font-style: italic for emphasis, rather than using ALL CAPS or bold text.
- Only use font-style: oblique if the font you're using doesn't have an italic version, as it may not look as good.
- Always test your website or application on multiple devices and browsers to ensure compatibility.
Browser Compatibility
Chrome | Firefox | Safari | Internet Explorer | Microsoft Edge | Opera |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |