0
votes

I am working on a project and while doing the header I cannot find a reason why the span icon-bar in a button for dropdown is not showing have a look:

Here is the html for the code you have to look for the third div in the row which is the div with two buttons inside it:

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
    <meta charset="UTF-8">
    <title>SoftHouse</title>
</head>
<body>
<div class="container">

    <nav class="navbar navbar-default">

        <div class="container">

            <div class="row">

            <div class="navbar-header col-lg-4">

                <a href="#" class="navbar-brand"><span class="wb"><span class="big">S</span>OFT</span><span class="big">H</span>OUSE</a>

            </div>

            <div class="nav-container col-lg-4">

            <ul class="nav nav-justified">
                <li>What</li>
                <li>Work</li>
                <li>About</li>
            </ul>

            </div>

            <div class="col-lg-4" style="text-align: center;">

                <button class="btn btn-sm">CONTACT</button>
                <button>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>



        </div>

    </div>

    </nav>

</div>


</body>
</html>

Here is the css

body
{
    margin:0;
    padding:0;
}

.navbar-default{
    border-radius: 0;
    background-color: white;
}

.wb
{
font-weight:bold;
}

.big
{
font-size: 25px;
}

.navbar-header .navbar-brand
{
font-size: 17px;
}

.icon-bar
{
    background-color: red;
    color:red;
}

.nav-justified
{
    line-height: 52px;
}
3

3 Answers

0
votes

You can add only bootstrap button class for toggle icon bar same as below:

see Updated demo

<button type="button" class="navbar-toggle" data-toggle="collapse" data-
 target="Your class">
  <span class="icon-bar"></span>
  <span class="icon-bar"></span>
  <span class="icon-bar"></span>
</button>

CSS:

.btn-group-sm>.btn, .btn-sm {
    float: none;
}
.navbar-toggle {
    display: inline-block;
    float: none;
}
0
votes

You say: i want icon bar be show always,so can use of after , no need bootstarp icons:

Css :

.btn-sm + span:after {
    content: '\2261';
    margin-left: 10px;
    font-size: 15px;
} 

Html:

<div class="col-lg-4" style="text-align: center;">
   <button class="btn btn-sm">CONTACT</button>
   <span><span><--------------Added
   <span class="icon-bar"></span><---------------Remove
   <span class="icon-bar"></span><---------------Remove
   <span class="icon-bar"></span><---------------Remove
</div>

body
{
    margin:0;
    padding:0;
}

.navbar-default{
    border-radius: 0;
    background-color: white;
}

.wb
{
font-weight:bold;
}

.big
{
font-size: 25px;
}

.navbar-header .navbar-brand
{
font-size: 17px;
}

.icon-bar
{
    background-color: red;
    color:red;
}

.nav-justified
{
    line-height: 52px;
} 

.btn-sm + span {
    border:1px solid #ccc;
    text-align:center;
    padding:5px 10px;
    cursor:pointer;
}

.btn-sm + span:hover {
 background-color:#ccc;
}

.btn-sm + span:after {
    content: '\2261';
    font-size: 15px;
}        
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="container">

    <nav class="navbar navbar-default">

        <div class="container">

            <div class="row">

            <div class="navbar-header col-lg-4">

                <a href="#" class="navbar-brand"><span class="wb"><span class="big">S</span>OFT</span><span class="big">H</span>OUSE</a>

            </div>

            <div class="nav-container col-lg-4">

            <ul class="nav nav-justified">
                <li>What</li>
                <li>Work</li>
                <li>About</li>
            </ul>

            </div>

            <div class="col-lg-4" style="text-align: center;">

                <button class="btn btn-sm">CONTACT</button>
                <span></span>
            </div>



        </div>

    </div>

    </nav>

</div>
0
votes

do this with font awesome

html code:-

        <!DOCTYPE html>
        <head>
         <meta charset="UTF-8">
         <meta name="viewport" content="width=device-width, initial-scale=1">
         <title>SoftHouse</title>

         <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
         <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
         <link rel="stylesheet" type="text/css" href="css/style.css">

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

            <nav class="navbar navbar-default">

                <div class="container">

                    <div class="row">

                        <div class="navbar-header col-lg-4">

                            <a href="#" class="navbar-brand"><span class="wb"><span class="big">S</span>OFT</span><span class="big">H</span>OUSE</a>

                        </div>

                        <div class="nav-container col-lg-4">

                        <ul class="nav nav-justified">
                            <li>What</li>
                            <li>Work</li>
                            <li>About</li>
                        </ul>

                        </div>

                        <div class="col-lg-4" style="text-align: center;">

                            <button class="btn btn-sm">CONTACT</button>
                            <a class="icon-bar" href="#"><i class="fa fa-caret-down"></i></a>
                        </div>
                   </div>

               </div>

            </nav>

        </div>

        </body>
        </html>

in css:-

.icon-bar { color: red; }