如何删除在dropmenu Bootstrap 3.3.7中生成的箭头

时间:2018-12-08 12:48:32

标签: html twitter-bootstrap twitter-bootstrap-3

我对引导程序提供的导航栏有疑问。使用下拉菜单时,它将生成上下箭头。我如何删除箭头?我已经搜索了互联网,但仍然无法解决问题。

 <nav class="navbar navbar-default">
     <div class="container-fluid">

        <div class="navbar-header">
     <button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
        <i class="glyphicon glyphicon-align-left"></i>
            <span></span>
     </button>
     </div>

       <ul class="nav navbar-nav navbar-right">
           <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" >Menu<span class="caret"></span></a>
               <ul class="dropdown-menu">
                 <li><a href="#">a</a></li>
                 <li><a href="#">b</a></li>
                 <li><a href="#">c</a></li>
               </ul>
           </li>
        </ul>
     </div>
 </nav>

以下是示例图片:https://imgur.com/a/Li6bTVi

1 个答案:

答案 0 :(得分:0)

您可以删除<span class="caret"></span>,也可以通过CSS将其隐藏起来,如下所示:

.dropdown-toggle .caret {
        display:none;
    }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<nav class="navbar navbar-default">
     <div class="container-fluid">

        <div class="navbar-header">
     <button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
        <i class="glyphicon glyphicon-align-left"></i>
            <span></span>
     </button>
     </div>

       <ul class="nav navbar-nav navbar-right">
           <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" >Menu<span class="caret"></span></a>
               <ul class="dropdown-menu">
                 <li><a href="#">a</a></li>
                 <li><a href="#">b</a></li>
                 <li><a href="#">c</a></li>
               </ul>
           </li>
        </ul>
     </div>
 </nav>