gpt4 book ai didi

css - 如何使用 Google Material Design Sprite 图标..?

转载 作者:太空宇宙 更新时间:2023-11-04 09:41:27 25 4
gpt4 key购买 nike

我正在尝试使用 Google Material Icons Sprite..他们提供的 CSS 是这样的

.icon {
background-image: url(../images/sprite-alert-white.PNG);
}
.icon-ic_add_alert_white_24dp {
background-position: -0px -0px;
width: 32px;
height: 32px;
}
.icon-ic_error_outline_white_24dp {
background-position: -32px -0px;
width: 32px;
height: 32px;
}
.icon-ic_error_white_24dp {
background-position: -0px -32px;
width: 32px;
height: 32px;
}
.icon-ic_warning_white_24dp {
background-position: -32px -32px;
width: 32px;
height: 32px;
}
.icon {
background-image: url(../images/sprite-alert-black.PNG);
}
.icon-ic_add_alert_black_24dp {
background-position: -0px -0px;
width: 32px;
height: 32px;
}
.icon-ic_error_black_24dp {
background-position: -32px -0px;
width: 32px;
height: 32px;
}
.icon-ic_error_outline_black_24dp {
background-position: -0px -32px;
width: 32px;
height: 32px;
}
.icon-ic_warning_black_24dp {
background-position: -32px -32px;
width: 32px;
height: 32px;
}
.icon {
background-image: url(../images/sprite-toggle-white.PNG);
}
.icon-ic_check_box_outline_blank_white_24dp {
background-position: -0px -0px;
width: 32px;
height: 32px;
}
.icon-ic_check_box_white_24dp {
background-position: -32px -0px;
width: 32px;
height: 32px;
}
.icon-ic_indeterminate_check_box_white_24dp {
background-position: -0px -32px;
width: 32px;
height: 32px;
}
.icon-ic_radio_button_checked_white_24dp {
background-position: -32px -32px;
width: 32px;
height: 32px;
}
.icon-ic_radio_button_unchecked_white_24dp {
background-position: -64px -0px;
width: 32px;
height: 32px;
}
.icon-ic_star_border_white_24dp {
background-position: -64px -32px;
width: 32px;
height: 32px;
}
.icon-ic_star_half_white_24dp {
background-position: -0px -64px;
width: 32px;
height: 32px;
}
.icon-ic_star_white_24dp {
background-position: -32px -64px;
width: 32px;
height: 32px;
}
.icon {
background-image: url(../images/sprite-toggle-black.PNG);
}

困惑是当我尝试使用

<div class="icon icon-ic_add_alert_white_24dp"></div>

效果不错...但是当我把这个...

 <div class="icon icon-ic_add_alert_black_24dp"></div>

它不起作用...我认为是因为 .icon 被设置了多次,它根据浏览器采用 .icon 的第一个或最后一个值..

.icon { background-image: ---------

但它的谷歌他们必须验证他们的 CSS,你能指导它应该如何工作吗,我是 Sprites 的新手...

引用

1) https://github.com/google/material-design-icons/tree/master/sprites

2) https://design.google.com/icons/

请帮忙

最佳答案

试试这个

.icon {
background-image: url(../images/sprite-alert-white.PNG);
}
.iconBlack {
background-image: url(../images/sprite-alert-black.PNG);
}
<div class="iconBlack icon-ic_add_alert_black_24dp"></div>

关于css - 如何使用 Google Material Design Sprite 图标..?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39875347/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com