什么是 CSS 图标?



图标来自可扩展的矢量库,可以使用 CSS 进行自定义

常用库有:

  • Font Awesome Icons
  • Bootstrap Icons
  • Google Icons


How To?

To use icons, just add a link to the icon library the <head> section of your HTML page:

No downloads or installations required!

To insert an icon, add the name of the icon class to any inline HTML element like <i> or <span>.

Font Awesome 实例

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/cdnjs/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>

<i class="fa fa-cloud"></i>
<i class="fa fa-heart"></i>
<i class="fa fa-car"></i>
<i class="fa fa-file"></i>
<i class="fa fa-bars"></i>

</body>
</html>
亲自试一试 »

有关图标的完整列表(Font Awesome、Bootstrap 和 Google),请访问 W3School 的图标参考



Bootstrap 实例

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://www.w3ccoo.com/lib/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>

<i class="glyphicon glyphicon-cloud"></i>
<i class="glyphicon glyphicon-remove"></i>
<i class="glyphicon glyphicon-user"></i>
<i class="glyphicon glyphicon-envelope"></i>
<i class="glyphicon glyphicon-thumbs-up"></i>

</body>
</html>
亲自试一试 »

Google 实例

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>

<i class="material-icons">cloud</i>
<i class="material-icons">favorite</i>
<i class="material-icons">attachment</i>
<i class="material-icons">computer</i>
<i class="material-icons">traffic</i>

</body>
</html>
亲自试一试 »

完整的图标教程

这是对图标的简短描述。

如需完整的图标教程,请访问 W3Schools 图标教程

有关完整的图标参考,请转到 W3Schools 图标参考