您现在的位置是:首页 > 文章详情

Boxicons —— 开源 Web 图标库

日期:2022-12-10点击:593

Boxicons 是一个精心设计的开源图标集,包含 1500 多个图标,可丰富您的网站/应用程序体验。

安装

要通过 npm 安装,只需执行以下操作:

$ npm install boxicons --save

导入模块

import 'boxicons';

用法

通过 CSS 使用

  1. 将样式表包含在文档的<head>
<head> <link rel="stylesheet" href="boxicons.min.css"> </head>

可以使用远程版本

<head> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css"> <!-- or --> <link rel="stylesheet" href="https://unpkg.com/boxicons@latest/css/boxicons.min.css"> </head>
  1. 要在页面上使用图标,请添加类“bx”和单独的类,图标名称的前缀为“bx-”用于常规图标,“bxs-”用于实体图标,“bxl-”用于徽标:
<i class="bx bx-hot"></i> <i class="bx bxs-hot"></i> <i class="bx bxl-facebook-square"></i>

通过 Web 组件使用

Boxicons 包含一个自定义元素,使图标的使用变得简单高效。要使用它,请将box-icon-element.js文件添加到页面:

<script src="https://unpkg.com/boxicons@2.1.3/dist/boxicons.js"></script>

要使用图标,请将<box-icon>元素添加到应显示图标的位置:

<box-icon name="hot"></box-icon>

要使用实体图标或徽标,请在名称前添加实体或徽标属性类型

<box-icon type="solid" name="hot"></box-icon> <box-icon type="logo" name="facebook-square"></box-icon>

<box-icon>自定义元素支持以下属性:

<box-icon type = "regular|solid|logo" name="adjust|alarms|etc...." color="blue|red|etc..." size="xs|sm|md|lg|cssSize" rotate="90|180|270" flip="horizontal|vertical" border="square|circle" animation="spin|tada|etc..." pull = "left|right" ></box-icon>
原文链接:https://www.oschina.net/p/boxicons
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章