DigitalOcean provides cloud products for every stage of your journey. Get started with $200 in free credit!
The font-style
property allows you to make text appear italicized (i.e. sloped, or slanted).
em {
font-style: italic;
}
This property accepts one of three possible values: normal
, italic
, and oblique
.
If a given font family has an italic or oblique face embedded, the browser will select that face. If no italic or oblique face is available, the browser will mimic the sloping effect. If italic is defined and there is no italic face available, the browser will look for an oblique face before it tries to mimic the italic. The same applies to oblique; it too will look first for an italic face.
To prevent the browser from adding a mimicked, or synthesized, version of the italic or oblique face, you may use the font-synthesis
property (if supported).
Italic vs. Oblique
According to the spec, “Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face.” However, if the font being used does not have italic or oblique faces available, in most cases there is little, if any, difference between italic and oblique.
The demo below demonstrates both italic and oblique:
See the Pen Italic vs. oblique with CSS font-style by CSS-Tricks (@css-tricks) on CodePen.
Related Properties
Other Resources
Browser Support
Chrome | Safari | Firefox | Opera | IE | Android | iOS |
---|---|---|---|---|---|---|
Works | Works | Works | Works | Works | Works | Works |
Hey my italic isn’t working for external css,
stylesheet
My website
what should i do?
my email
[email protected]
Your
body
tag is missing it’s closing brackets. TryHi there,
I put this code:
em {
font-style: italic;
}
in my external CSS shhet on my site site here: http://alaskahealer.com/services/
Here’s the html on the page: No drop ins. By appointment only.
It does not show up italicized in Safari and IE 11
Code Pen: http://codepen.io/anon/pen/rVRVQm
Do you know why?
Geej
Hi Geej,
The reason that’s happening is because you are you using a font called “Muli”, which is this one:
http://www.fontsquirrel.com/fonts/muli
That’s only the regular Muli font. It doesn’t seem to have an italic version, it’s just the regular one. If you change the CSS to the following, it will work:
Or any other way to include the “muli italic” version of the font.
I can’t change my email font — getting bold.
Hi! Louis I would like to use Menlo for the normal paragraph text but a different font (Arial) for italic text and H1 H2 etc but i can’t seem to figure out the code. Can you point me in the right direction??
Many thanks
johannes
You have to define that in your CSS.
That’s one way to do it, but it also depends on what else is in your stylesheet.
thank you Louis!
when I use in my wordpress theme css it always comes out bold. tried !Important as well. but still the same. anyone has any idea. its not the main style.css