One*_*ezy 5 css svg font-face icon-fonts material-design
(图标字体大小不正确)
我知道我可以使用CSS修复它们(我已经在下面的代码段中完成了此操作)。但为什么?我可以在样式表中添加CSS技术,以免发生这种情况吗?
Google建议您将“材料设计”图标设置为以下尺寸:
.material-icons.md-18 { font-size: 18px; }
.material-icons.md-24 { font-size: 24px; }
.material-icons.md-36 { font-size: 36px; }
.material-icons.md-48 { font-size: 48px; }
Run Code Online (Sandbox Code Playgroud)
但是这样做时,“桌面”屏幕上的素材图标会失真。“移动”屏幕没有问题,因为DPI分辨率更好。当然,这个问题不仅存在于字体图标中,而且还存在于其他网络字体中(Roboto是最受欢迎的字体之一)。
我在这里做错什么了吗?解决此问题的最佳方法是什么?
这是我在屏幕上看到的图像
(您必须在新窗口中将其打开才能查看完整分辨率):
这是我的代码:
.material-icons.md-18 { font-size: 18px; }
.material-icons.md-24 { font-size: 24px; }
.material-icons.md-36 { font-size: 36px; }
.material-icons.md-48 { font-size: 48px; }
Run Code Online (Sandbox Code Playgroud)
/* Reset */
*, *:after, *:before, *:focus { margin: 0; padding: 0; box-sizing: border-box; outline: 0; }
html { font-family: "Arial"; }
body { padding: 2rem; }
h1 { padding: 0 0 1rem; }
h3 { padding: 0 0 1rem; }
ul { list-style: none; }
section { padding: 1rem; margin: 0 0 1rem; }
/* Material Design Icons */
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: local('Material Icons'), local('MaterialIcons-Regular'), url(https://fonts.gstatic.com/s/materialicons/v14/2fcrYFNaTjcS6g4U3t-Y5ZjZjT5FdEJ140U2DJYC3mY.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}
/* Icon Sizes (BAD) */
.md-18 { font-size: 18px; }
.md-24 { font-size: 24px; }
.md-36 { font-size: 36px; }
.md-48 { font-size: 48px; }
/* Icon Sizes (GOOD) */
.md-14 { font-size: 14px; }
.md-29 { font-size: 29px; }
.md-34 { font-size: 34px; }
.md-44 { font-size: 44px; }
.md-48 { font-size: 48px; }
/* Bad - Good */
.bad { background: rgba(235, 90, 70, .47); }
.good { background: rgba(81, 232, 152, .47); }Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1630 次 |
| 最近记录: |