如何使用 Google Material 设计 Sprite 图标..?
How to use Google Material Design Sprite icons..?
我正在尝试使用 Google Material 图标 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: ---------
但它 Google 他们必须验证他们的 CSS,你能指导它应该如何工作吗,我是 Sprites 的新手...
REF
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>
我正在尝试使用 Google Material 图标 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: ---------
但它 Google 他们必须验证他们的 CSS,你能指导它应该如何工作吗,我是 Sprites 的新手...
REF
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>