旋转特效
使用Bootstrap的旋转特效来显示组件或页面的加载状态,该特效完全使用HTML、CSS构建,并没有使用JavaScript。更新于: 2023-04-30 14:28:21 查看: 538
发布于: 2021-9-6 20:04 发布者: 大米
为了便于访问,这里的每个加载程序都包含 role="status"
和嵌套的 <span class="visually-hidden">Loading...</span>
。
旋转器的边框
旋转器的边框可用于轻量的加载显示。
Loading...
<div class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
</div>
旋转器的颜色
旋转体的边框会使用 currentColor
作为边框颜色,这意味着您可以 使用文本颜色工具自定义颜色 。您可以在旋转器上使用我们的任何文本颜色实用工具。
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-secondary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-success" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-danger" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-warning" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-info" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-light" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-dark" role="status">
<span class="visually-hidden">Loading...</span>
</div>
渐变加载
如果您不喜欢旋转器,请切换到渐变加载。 虽然从技术上讲它并不是旋转的,但是它是反复增长的!
Loading...
<div class="spinner-grow" role="status">
<span class="visually-hidden">Loading...</span>
</div>
同样,这个加载特效的颜色也是由 currentColor
属性决定的,因此您可以使用文本颜色工具轻松地更改其外观。这里是蓝色的,并且它也可以支持的各种的颜色变化。
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
<div class="spinner-grow text-primary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-secondary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-success" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-danger" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-warning" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-info" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-light" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-dark" role="status">
<span class="visually-hidden">Loading...</span>
</div>
边距工具
使用边距工具,利用像.m-5
的工具可以轻松实现布局边距
Loading...
<div class="spinner-border m-5" role="status">
<span class="visually-hidden">Loading...</span>
</div>
旋转器的定位
你在任何情况下,都可以使用flexbox 工具,浮动工具或者文本对齐工具来将旋转器精确地放置在任何需要它们的位置
弹性布局
Loading...
<div class="d-flex justify-content-center">
<div class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
Loading...
<div class="d-flex align-items-center">
<strong>Loading...</strong>
<div class="spinner-border ms-auto" role="status" aria-hidden="true"></div>
</div>
Loading...
<div class="d-flex align-items-center justify-content-center">
<div class="spinner-border me-2" role="status" aria-hidden="true"></div><strong>Loading...</strong>
</div>
浮动布局
Loading...
<div class="clearfix">
<div class="spinner-border float-end" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
文本对齐
Loading...
<div class="text-center">
<div class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
Loading...
Loading...
<div class="spinner-border spinner-border-sm" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow spinner-grow-sm" role="status">
<span class="visually-hidden">Loading...</span>
</div>
或者,你也可以使用自定义CSS或内联样式来根据需要更改旋转器的大小。
Loading...
Loading...
<div class="spinner-border" style="width: 3rem; height: 3rem;" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow" style="width: 3rem; height: 3rem;" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<button class="btn btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
<span class="visually-hidden">Loading...</span>
</button>
<button class="btn btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Loading...
</button>
<button class="btn btn-primary" type="button" disabled>
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
<span class="visually-hidden">Loading...</span>
</button>
<button class="btn btn-primary" type="button" disabled>
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
Loading...
</button>
扫描二维码,手机查看
声明:部分数据/图片来源互联网,不代表Hluse Doc.,真实性请妥善甄别。