我想将<span>
标签的font-family更改为Opensans SemiboldItalic字体。但我不知道怎么办?
#footer .container span {
font-family: 'Open Sans Semibold';
}
答案 0 :(得分:7)
你必须使用font-weight和font-style。
font-family: 'Open Sans', Arial, sans-serif;
font-weight: 600;
font-style: italic;
确保您也调用半粗体斜体字体粗细(600):
<link href='//fonts.googleapis.com/css?family=Open+Sans:600italic' rel='stylesheet' type='text/css'>
答案 1 :(得分:1)
如果您使用的是Google字体,则右侧有一些关于使用情况的教程: https://www.google.com/fonts#UsePlace:use/Collection:Open+Sans
font-family: 'Open Sans', sans-serif;
要更改字体粗细,您可以查看上表。 Semi-Bold的数字是600,所以:
font-weight: 600;
这很容易。
编辑:忘记斜体样式:
font-style: italic;
答案 2 :(得分:0)
除非你获得faux italic (ie: letting the browser italicize the font rather than displaying the italic font),否则你必须确保自己使用半粗体斜体字体:
<link href='http://fonts.googleapis.com/css?family=Open+Sans:600italic' rel='stylesheet' type='text/css'>
如果您想从该系列中获得更多品种,您也必须指定它们。例如,如果您想要400正常和斜体以及600正常和斜体,则链接将是:
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic' rel='stylesheet' type='text/css'>
这解决了这些风格:
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v13/cJZKeOuBrn4kERxqtaUH3ZBw1xU1rKptJj_0jans920.woff2) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 600;
src: local('Open Sans Semibold'), local('OpenSans-Semibold'), url(http://fonts.gstatic.com/s/opensans/v13/MTP_ySUJH_bn48VBG8sNShampu5_7CjHW5spxoeN3Vs.woff2) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 400;
src: local('Open Sans Italic'), local('OpenSans-Italic'), url(http://fonts.gstatic.com/s/opensans/v13/xjAJXh38I15wypJXxuGMBogp9Q8gbYrhqGlRav_IXfk.woff2) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 600;
src: local('Open Sans Semibold Italic'), local('OpenSans-SemiboldItalic'), url(http://fonts.gstatic.com/s/opensans/v13/PRmiXeptR36kaC0GEAetxsiAiQ_a33snTsJhwZvMEaI.woff2) format('woff2');
}