BootStrap笔记-badge的使用

x33g5p2x  于2022-02-07 转载在 Bootstrap  
字(2.2k)|赞(0)|评价(0)|浏览(380)

运行截图如下;

代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CN_TEST1</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!--    bootstrap css核心文件-->
    <link rel="stylesheet" href="bootstrap-4.4.1-dist/css/bootstrap.min.css">
<!--    bootstrap使用到了jquery,需要提前引用-->
    <script src="js/jquery-3.5.1.min.js"></script>
<!--    弹窗、提示、下拉菜单-->
    <script src="bootstrap-4.4.1-dist/js/bootstrap.bundle.js"></script>
<!--    bootstrap核心文件-->
    <script src="bootstrap-4.4.1-dist/js/bootstrap.min.js"></script>

</head>
<body>
    <div class="container-fluid">

        <h1>测试<span class="badge badge-primary">primary</span></h1>
        <h1>测试<span class="badge badge-danger">danger</span></h1>
        <h2>测试<span class="badge badge-secondary">secondary</span></h2>
        <h2>测试<span class="badge badge-success">success</span></h2>
        <h3>测试<span class="badge badge-info">info</span></h3>
        <h3>测试<span class="badge badge-light">light</span></h3>
        <h4>测试<span class="badge badge-warning">warning</span></h4>
        <h4>测试<span class="badge badge-primary">primary</span></h4>
        <h5>测试<span class="badge badge-dark">dark</span></h5>
        <h6>测试<span class="badge badge-primary">primary</span></h6>
        <h6>测试<span class="badge badge-danger">danger</span></h6>

        <br/>
        <span class="badge badge-pill badge-danger">danger</span>
        <span class="badge badge-pill badge-primary">primary</span>
        <br/>
        <button type="button" class="btn btn-primary">
            Message <span class="badge badge-info">4</span>
        </button>

    </div>
</body>
</html>

要注意的地方:

①badge为徽章,标签,同样要先要在class中,标名他是badge,然后再设置他的其他属性。

相关文章