Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
Set the font style with CSS
To set the font style, use the font-style property. This CSS property allows you to make text appear italic, normal, or oblique.
Syntax
font-style: normal | italic | oblique;
Values
- normal - Default font style (upright text)
- italic - Slanted version of the font (if available)
- oblique - Artificially slanted text
Example: Italic Font Style
You can try to run the following code to set the font-style to italic with CSS:
<!DOCTYPE html>
<html>
<head>
<title>Font Style Example</title>
</head>
<body>
<p style="font-style:italic;">
Europe, Australia, South America are continents.
</p>
</body>
</html>
Example: All Font Styles
<!DOCTYPE html>
<html>
<head>
<style>
.normal { font-style: normal; }
.italic { font-style: italic; }
.oblique { font-style: oblique; }
</style>
</head>
<body>
<p class="normal">This text has normal font style.</p>
<p class="italic">This text has italic font style.</p>
<p class="oblique">This text has oblique font style.</p>
</body>
</html>
Comparison
| Value | Description | Use Case |
|---|---|---|
normal |
Default upright text | Body text, paragraphs |
italic |
True italic version of font | Emphasis, book titles |
oblique |
Artificially slanted text | When italic is not available |
Conclusion
Use the font-style property to control text appearance. italic is most commonly used for emphasis and styling headings or quotes.
Advertisements
