I would like to use the italic variant of a font as a backup font in my font-family
list in my CSS file. Is this possible in any way? Something like:
font-family: SuperSlanty, Verdana-Italic;
I would like to use the italic variant of a font as a backup font in my font-family
list in my CSS file. Is this possible in any way? Something like:
font-family: SuperSlanty, Verdana-Italic;
Just use font-style:italic;
as described here.
Check this http://jsfiddle.net/Hd4zq/4/
You can load all the google fonts you need through JS in an array and then change the CSS font properties adding the right font-style (in your case italic) to a specific CSS class you will add to your html elements.
<script type="text/javascript">
google.load('webfont','1');
google.setOnLoadCallback(function() {
WebFont.load({
google: {
families: ['Droid Serif','Tangerine']
}
});
});
</script>
<p class="serif">SERIF</p>
<p class="serifItalic">SERIF ITALIC</p>
<p class="serifBold">SERIF BOLD</p>
<p class="serifBoldItalic">SERIF BOLD ITALIC</p>
<p class="tangerine">Tangerine</p>
.serif{
font-family:'Droid Serif';
font-size:30px;
font-style:normal;
font-weight: 400;
}
.serifItalic{
font-family:'Droid Serif';
font-size:30px;
font-style:italic;
font-weight: 400;
}
.serifBold{
font-family:'Droid Serif';
font-size:30px;
font-style:normal;
font-style:bold;
}
.serifBoldItalic{
font-family:'Droid Serif';
font-size:30px;
font-style:italic;
font-weight: bold;
}
.tangerine{
font-family:'Tangerine';
font-size:30px;
font-style:italic;
font-weight: bold;
}
And yes, you can add one of the font in italic as fallback by adding more than one font in the font-family property like:
.fontwithFallback{
font-family: 'Droid','Tangerine';
}