The font-style property in CSS is used to specify the style of the font. This property is most commonly used to set the text to be italic or oblique, but it can also be used to specify that the text should be rendered in a normal style.
Syntax
font-style: normal | italic | oblique | initial | inherit;
1. normal: The text is displayed in a normal, or regular, style. This is the default value.
2. italic: The text is displayed in an italicized style. This is usually a slanted version of the regular font.
3. oblique: The text is displayed in an oblique style, which is a slanted version of the normal font. It is similar to italic, but the angle of the slant is typically less pronounced.
4. initial: Sets the font-style to its default value, which is normal.
5. inherit: Inherits the font-style from its parent element.
fontStyle.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Font Style Example</title> <style> body { font-family: Arial, sans-serif; line-height: 1.6; font-size: 1.2em; } h1 { color: #333; } /* Applying different font styles */ .normal { font-style: normal; } .italic { font-style: italic; } .oblique { font-style: oblique; } </style> </head> <body> <h1>CSS Font Style Examples</h1> <p class="normal">This text is in the normal font style.</p> <p class="italic">This text is in the italic font style.</p> <p class="oblique">This text is in the oblique font style.</p> </body> </html>
Previous Next Home
No comments:
Post a Comment