我已将“材料图标”四舍五入到我的网页,如下所示:
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round" rel="stylesheet">
我有用于圆形类的css代码
.material-icons.material-icons--rounded {
font-family: 'Material Icons Round';
}
在页面中,星形图标如下所示:
如果我增加字体大小,它将变为:
该边框从何而来以及如何将其删除?
编辑:我已经创建了一支笔来重现问题https://codepen.io/anon/pen/wOJdMZ
@import "https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round";
.material-icons--rounded {
font-family: "Material Icons Round";
}
i {
color: red;
}
.material-icons {
font-size: 60px;
}
.size--2 {
font-size: 90px;
}
<table>
<tr>
<th>Rounded</th>
<td><i class="material-icons material-icons--rounded">star</i></td>
<td><i class="material-icons material-icons--rounded size--2">star</i></td>
<td><i class="material-icons material-icons--rounded">star_half</i></td>
<td><i class="material-icons material-icons--rounded size--2">star_half</i></td>
<td><i class="material-icons material-icons--rounded">star_border</i></td>
<td><i class="material-icons material-icons--rounded size--2">star_border</i></td>
</tr>
<tr>
<th>Not Rounded<br>
<td><i class="material-icons">star</i></td>
<td><i class="material-icons size--2">star</i></td>
<td><i class="material-icons">star_half</i></td>
<td><i class="material-icons size--2">star_half</i></td>
<td><i class="material-icons">star_border</i></td>
<td><i class="material-icons size--2">star_border</i></td>
</tr>
</table>
更新: 在某些屏幕尺寸上,圆角的图标颜色没有改变。
我已经更新了问题所附的代码段。
更新2
答案 0 :(得分:1)
字形本身似乎有问题
如果您从此处下载SVG字形
https://material.io/tools/icons/?icon=star&style=round
还有https://material.io/tools/icons/?icon=star&style=round
您会看到rounded glyph是错误的,而pointy star是正确的
您应该将问题提交给https://github.com/material-components
路径为path("M 0 0 h 24 v 24 H 0 V 0 Z m 0 0 h 24 v 24 H 0 V 0 Z m 12 17.27 l 4.15 2.51 c 0.76 0.46 1.69 -0.22 1.49 -1.08 l -1.1 -4.72 l 3.67 -3.18 c 0.67 -0.58 0.31 -1.68 -0.57 -1.75 l -4.83 -0.41 l -1.89 -4.46 c -0.34 -0.81 -1.5 -0.81 -1.84 0 L 9.19 8.63 l -4.83 0.41 c -0.88 0.07 -1.24 1.17 -0.57 1.75 l 3.67 3.18 l -1.1 4.72 c -0.2 0.86 0.73 1.54 1.49 1.08 l 4.15 -2.5 Z");
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 24 24" wtx-context="97FAD225-6CA6-4D16-A578-52C0523A648F"><path d="M0 0h24v24H0V0zm0 0h24v24H0V0zm12 17.27l4.15 2.51c.76.46 1.69-.22 1.49-1.08l-1.1-4.72 3.67-3.18c.67-.58.31-1.68-.57-1.75l-4.83-.41-1.89-4.46c-.34-.81-1.5-.81-1.84 0L9.19 8.63l-4.83.41c-.88.07-1.24 1.17-.57 1.75l3.67 3.18-1.1 4.72c-.2.86.73 1.54 1.49 1.08l4.15-2.5z"/></svg>
但应为path("M 12 17.27 l 4.15 2.51 c 0.76 0.46 1.69 -0.22 1.49 -1.08 l -1.1 -4.72 l 3.67 -3.18 c 0.67 -0.58 0.31 -1.68 -0.57 -1.75 l -4.83 -0.41 l -1.89 -4.46 c -0.34 -0.81 -1.5 -0.81 -1.84 0 L 9.19 8.63 l -4.83 0.41 c -0.88 0.07 -1.24 1.17 -0.57 1.75 l 3.67 3.18 l -1.1 4.72 c -0.2 0.86 0.73 1.54 1.49 1.08 l 4.15 -2.5 Z")
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 24 24" wtx-context="97FAD225-6CA6-4D16-A578-52C0523A648F"><path d="M 12 17.27 l 4.15 2.51 c 0.76 0.46 1.69 -0.22 1.49 -1.08 l -1.1 -4.72 l 3.67 -3.18 c 0.67 -0.58 0.31 -1.68 -0.57 -1.75 l -4.83 -0.41 l -1.89 -4.46 c -0.34 -0.81 -1.5 -0.81 -1.84 0 L 9.19 8.63 l -4.83 0.41 c -0.88 0.07 -1.24 1.17 -0.57 1.75 l 3.67 3.18 l -1.1 4.72 c -0.2 0.86 0.73 1.54 1.49 1.08 l 4.15 -2.5 Z"/></svg>
答案 1 :(得分:0)
问题是...您在两个类中都添加了字体大小。
我将其替换为新的课程size--1
.size--1 {
font-size: 60px;
}
.size--2 {
font-size: 90px;
}
.material-icons--rounded {
font-family: 'Material Icons Round;
}
material-icons类不需要这种样式...(如果我理解正确的话,他正在应用图标)
HTML:
<i class="material-icons material-icons--rounded size--1">star</i>
<i class="material-icons material-icons--rounded size--2">star</i>
看到了更新的笔... 我已经尝试过
outline: none !important;
border: none !important;
box-shadow: none !important;
这些都不起作用...
星形从字体大小:67px开始变成正方形,甚至transform: scale(2,2)
都没有帮助。 rounded
类出了问题))