圆角 Material 图标边框和颜色问题
Rounded Material Icons border and color problem
我已经在我的网页中添加了 Material 个圆角图标:
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round" rel="stylesheet">
我有 css 舍入代码 class
.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>
更新:
圆形图标颜色在某些屏幕尺寸上没有变化。
我已经更新了问题所附的代码片段。
- 在 1920x1080 显示器上,所有图标都是红色的。
- 在 2560 x 1600 macbook 视网膜屏幕上,圆形图标为黑色,其他为红色。 (这在 Chrome 或 Firefox 上似乎不是问题)
更新 2
颜色问题没有解决。 视网膜屏幕上的图标没有任何颜色。
他们总是黑色的。
需要帮助。
问题是...您为两个 classes 添加了字体大小。
我用新的 class size--1
替换了它
.size--1 {
font-size: 60px;
}
.size--2 {
font-size: 90px;
}
.material-icons--rounded {
font-family: 'Material Icons Round;
}
material-图标 class 不需要那种风格...(他正在应用图标,如果我没理解错的话)
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;
None 其中有效...
星星变成正方形,从 font-size: 67px 开始...甚至 transform: scale(2,2)
也没有帮助。 rounded
class))
有问题
字形本身好像有问题
如果您从这里下载 SVG 字形
https://material.io/tools/icons/?icon=star&style=round
这里 https://material.io/tools/icons/?icon=star&style=round
你可以看到rounded glyph is wrong and the pointy star是正确的
您应该向 https://github.com/material-components
提交问题
给 material 团队的一些信息
路径是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>
我已经在我的网页中添加了 Material 个圆角图标:
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round" rel="stylesheet">
我有 css 舍入代码 class
.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>
更新: 圆形图标颜色在某些屏幕尺寸上没有变化。
我已经更新了问题所附的代码片段。
- 在 1920x1080 显示器上,所有图标都是红色的。
- 在 2560 x 1600 macbook 视网膜屏幕上,圆形图标为黑色,其他为红色。 (这在 Chrome 或 Firefox 上似乎不是问题)
更新 2
颜色问题没有解决。 视网膜屏幕上的图标没有任何颜色。
他们总是黑色的。
问题是...您为两个 classes 添加了字体大小。
我用新的 class size--1
.size--1 {
font-size: 60px;
}
.size--2 {
font-size: 90px;
}
.material-icons--rounded {
font-family: 'Material Icons Round;
}
material-图标 class 不需要那种风格...(他正在应用图标,如果我没理解错的话)
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;
None 其中有效...
星星变成正方形,从 font-size: 67px 开始...甚至 transform: scale(2,2)
也没有帮助。 rounded
class))
字形本身好像有问题
如果您从这里下载 SVG 字形
https://material.io/tools/icons/?icon=star&style=round
这里 https://material.io/tools/icons/?icon=star&style=round
你可以看到rounded glyph is wrong and the pointy star是正确的
您应该向 https://github.com/material-components
提交问题给 material 团队的一些信息
路径是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>