Boxicons开源 Web 图标库

联合创作 · 2023-09-29 20:48

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>

浏览 38
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报