【发布时间】:2017-07-13 02:07:32
【问题描述】:
我的 CSS 具有以下结构:
index.html
css
--fonts
----roboto
------roboto-italic-demo.html
------roboto-italic-webfont.woff
------roboto-italic-webfont.woff2
------stylesheet.css
--main.css
stylesheet.css 包含以下 CSS
@font-face {
font-family: 'robotoitalic';
src: url('roboto-italic-webfont.woff2') format('woff2'),
url('roboto-italic-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
roboto-italic-demo.html 是一个使用font-family: 'robotoitalic'; 显示整个字母字符的演示页面。这里的 g 看起来应该是这样的。
main.css 包含以下 css
@font-face {
font-family: 'roboto';
src: url('fonts/roboto/roboto-bolditalic-webfont.woff2') format('woff2'),
url('fonts/roboto/roboto-bolditalic-webfont.woff') format('woff');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: 'robototest2';
src: url('fonts/roboto/roboto-italic-webfont.woff2') format('woff2'),
url('fonts/roboto/roboto-italic-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
index.html 包括main.css 样式表。使用font-family: 'roboto'; font-style: italic; 会切断 g 字符的右侧。使用font-family: 'robototest2'; 也会剪切 g 字符的右侧。
为了解决这个问题,我尝试了以下方法:
重新下载
roboto-italic-webfont.woff&&roboto-italic-webfont.woff2将
"Comic Sans MS"作为备用,以确保我实际使用的是roboto或robototest2添加了字母间距
将 g 字符放在带填充的范围内
编辑:
这个问题被标记为重复。链接的问题是指从其容器中突出的文本,因为这个问题是关于一个字符被截断,无论其在任何标签中的位置如何。比如这个html
<p><em>This g is being cut off on its right side</em></p>
结果
【问题讨论】: