A
A
Alexey Yarkov2016-01-23 22:52:49
css
Alexey Yarkov, 2016-01-23 22:52:49

Why is the button floating in the navbar?

In the navbar, a button floats when the screen is reduced (in fact, it is needed for this).
Screen:
a8105274778f45f6983247be944e7d68.png
Code:

<nav class="navbar navbar-static-top navbar-inverse" role="navigation">
        
          <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbarCollapse">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Chat Example</a>
          </div>
          <!--nav-collapse -->
          <div id="navbarCollapse" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
              <li><a target="_blank" href="https://github.com/yarkovaleksei/AppChat">View on GitHub</a></li>
            </ul>
          </div>
          <!--/.nav-collapse -->
        
      </nav>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
display: block, 2016-01-23
@yarkov

Floats due to the width: 100% of the button described in chat.css

T
Teacher, 2016-01-23
@MrTeacher

Try it.

position: absolute;
    float: right;
    margin-right: 15px;
    padding: 9px 10px;
    margin-top: 13px;
    margin-bottom: 13px;
    background-color: transparent;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 0;
}

#
#rybak, 2016-01-23
@Ravell

.navbar-toggle {margin-right: 15px}
toggles 15 pixels to the left just
remove it
for normal padding set parent padding
.navbar-header{padding: 15px}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question