1

Bootstrap4的下拉菜单我觉得不好看,但是挺好用,所以我拿来美化了一下用在了项目中。

美化前

image.png

https://www.runoob.com/try/tr...

美化后

image.png

代码

<!DOCTYPE html>
<html>
<head>
  <title>Bootstrap dropdown</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
  <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
  <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
  <style type="text/css">
    body{
        background: #eee;
    }
    #app{
        width: 200px;
        margin:100px auto;
    }
    #app .dropdown .dropdown-btn{
        border:none;
        outline: none;
        border-radius: 5px;
        font-size: 15px;
        background: #fff;
        color: #666;
    }
    #app .dropdown .dropdown-menu{
        background: #fff;
        border: none;
        min-width:100px;
    }
    #app .dropdown .dropdown-menu .dropdown-item:hover{
        background: #f8f9fa;
        color: #666;
    }
    #app .dropdown .dropdown-menu .dropdown-item:active{
        background: #f8f9fa;
        color: #666;
    }
  </style>
</head>
<body>

<div id="app">
    <div class="dropdown">
        <button type="button" class="dropdown-btn" data-toggle="dropdown">•••</button>
        <div class="dropdown-menu">
          <a class="dropdown-item" href="#">Link 1</a>
          <a class="dropdown-item" href="#">Link 2</a>
          <a class="dropdown-item" href="#">Link 3</a>
        </div>
    </div>
</div>

</body>
</html>

作者

TANKING

如果大家还想美化Bootstrap的一些控件,可以找我(请我喝杯咖啡:WeChat:sansure2016)


TANKING
4.8k 声望493 粉丝

热爱分享,热爱创作,热爱研究。