Bootstrap 4 不再支持字形
Glyphicons no longer supported in Bootstrap 4
我从官方文档中了解到,Glyphicons 已从 Bootstrap 4.
中删除
今天,在我寻找实现复选框按钮的过程中,我发现了一个我非常欣赏的片段:
问题是此版本适用于 Bootstrap 3.0,其中 Glyph 还受支持。
所以我有 2 个问题:
- 哪个是 Glyphicons 的好替代品?或者有没有办法使用它们?
- 我如何更改上面的 html 和 js 片段以使其在 Bootstrap 4 中正常工作?
1 - 哪个是 Glyphicons 的好替代品?或者有没有办法使用它们?
最佳替代恕我直言:http://fontawesome.io/icons/
2 - 我如何更改上面的 html 和 js 片段以使其在 Bootstrap 4 中工作?
jQuery Checkbox Buttons - Bootstrap 4
您需要更改 JS:
settings = {
on: {
icon: 'fa fa-square-o'
},
off: {
icon: 'fa fa-check-square-o'
}
};
并且 css class .hidden
现已弃用,因此 Bootstrap 建议改用 style="display: none"
。
我同意@nerijunior Font Awesome 图标是最好的选择,这是经过测试的方法:
要使用 Font Awesome 图标,请将以下内容添加到您的 HTML 页面(无需下载或安装)给出以下示例:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h1>My Icons <i class="fas fa-heart"></i></h1>
<p>An icon along with some text: <i class="fas fa-thumbs-up"></i></p>
</div>
<div class="container">
<p>Others:</p>
<i class="fas fa-cloud"></i>
<i class="fas fa-coffee"></i>
<i class="fas fa-car"></i>
<i class="fas fa-file"></i>
<i class="fas fa-bars"></i>
</div>
</body>
</html>
我从官方文档中了解到,Glyphicons 已从 Bootstrap 4.
中删除今天,在我寻找实现复选框按钮的过程中,我发现了一个我非常欣赏的片段:
问题是此版本适用于 Bootstrap 3.0,其中 Glyph 还受支持。
所以我有 2 个问题:
- 哪个是 Glyphicons 的好替代品?或者有没有办法使用它们?
- 我如何更改上面的 html 和 js 片段以使其在 Bootstrap 4 中正常工作?
1 - 哪个是 Glyphicons 的好替代品?或者有没有办法使用它们?
最佳替代恕我直言:http://fontawesome.io/icons/
2 - 我如何更改上面的 html 和 js 片段以使其在 Bootstrap 4 中工作?
jQuery Checkbox Buttons - Bootstrap 4
您需要更改 JS:
settings = {
on: {
icon: 'fa fa-square-o'
},
off: {
icon: 'fa fa-check-square-o'
}
};
并且 css class .hidden
现已弃用,因此 Bootstrap 建议改用 style="display: none"
。
我同意@nerijunior Font Awesome 图标是最好的选择,这是经过测试的方法:
要使用 Font Awesome 图标,请将以下内容添加到您的 HTML 页面(无需下载或安装)给出以下示例:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h1>My Icons <i class="fas fa-heart"></i></h1>
<p>An icon along with some text: <i class="fas fa-thumbs-up"></i></p>
</div>
<div class="container">
<p>Others:</p>
<i class="fas fa-cloud"></i>
<i class="fas fa-coffee"></i>
<i class="fas fa-car"></i>
<i class="fas fa-file"></i>
<i class="fas fa-bars"></i>
</div>
</body>
</html>