I'm using a navbar for the standard nav stuff and i'd like to include a button for Sign in and Sign up.
The I'm using an a
tag with the btn btn-large btn-success
classes and by default it appears the navbar does not accommodate the use of nested btn
s.
The result is something like this:
And when hovered over, it comes out as:
My question is basically: Am i doing this wrong? Is there something I'm missing?
Thought i'd ask before I redefine CSS classes for .btn. within a navbar.
Thanks.
Use the . navbar-text class to vertical align any elements inside the navbar that are not links (ensures proper padding and text color).
To create a large button, use the . btn-lg class in Bootstrap.
Active/Disabled Buttons The class . active makes a button appear pressed, and the disabled attribute makes a button unclickable. Note that <a> elements do not support the disabled attribute and must therefore use the . disabled class to make it visually appear disabled.
Explanation: There are various styles to add a button in Bootstrap. The syntax for creating a success button in Bootstrap is: <button class = “btn btn-success”> success </button>.
The navbar accommodates buttons without a problem - I have buttons in the navbar without any problems, and I was able to add them to the static navbar example on the Bootstrap page:
The html should be laid out like this:
<div class="navbar navbar-fixed-top active"> <div class="navbar-inner"> <div class="container" style="width: auto;"> <a class="brand" href="#">Project name</a> <div class="nav-collapse"> <ul class="nav"> ... nav links ... </ul> <form class="navbar-search pull-left" action=""> ... search box stuff </form> <a class="btn btn-success">Sign in</a> <a class="btn btn-primary">Sign up</a> </div> </div> </div> </div>
If you're not using the responsive layout to collapse the navbar on smaller screens, just put your button links one level up, in <div class="container">
.
If you're still not finding the problem, try using Chrome's Dev Tools to see what CSS is being applied to the buttons that shouldn't be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With