"Fine-grained" how to create a responsive navigation bar based on Bootstrap

Source: Internet
Author: User

    • Local Downloads

The final results are as follows:

First you have to introduce Bootstrap and jquery.

Recommend a cdn:http://cdn.gbtags.com/index.html

Then you begin to write the HTML code. If you don't want to change the display, the CSS actually saves 2333.

Because the HTML code is much more divided into three sections and then last a whole HTML code

As shown first, implementing this effect requires understanding the following components of bootstrap

    • Navigation bar
    • Button
    • Form
    • Drop-down menu

In fact, there are a number of styles for the above components. We just need to know a little bit more. Please refer to the http://www.gbtags.com/api/bootstrap3.2/bootstrap-doc/components/index.html for more information.

ps:class{} Here is just comment not HTML code

PS2: Provides HTML files with an online case debug

Navigation bar and navigation bar logo layout

    1. <!--Create a bootstarp navigation bar and navigation logo layout--
    2. <nav Class="NavBar navbar-default">
    3. <div Class="Navbar-header">
    4. Do STH
    5. </div>
    6. </nav>

Navigation buttons

  1. <!--Create a button--
  2. <!--class{
  3. Navbar-toggle: Pass this button to JS can be clicked
  4. Collapsed: Do not combine navbar-collapse that is a default class. No seemingly no bug found.
  5. }
  6. Data-toggle= "collapse": Introducing the Collapse plugin
  7. data-target= "#navbar-gbtag": Which tab to jump/open when the button is clicked
  8. Aria-expanded= "false": auxiliary reading function. Settings for special people--
  9. <button type="button" class="Navbar-toggle collapsed" data-toggle ="collapse" data-target="#navbar-gbtag" aria-expanded="false" >
  10. <!--Add some icons and instructions to the button
  11. class{
  12. Sr-only: Hide this tag
  13. Incon-bar: Icon Style
  14. Try to change a standard style for Glyphicon Glyphicon-star
  15. }-->
  16. <span class="Sr-only"> point me </span>
  17. <span class="Icon-bar"></span>
  18. <span class="Icon-bar"></span>
  19. <span class="Icon-bar"></span>
  20. </button>

Form

  1. <div Class="Form-group">
  2. <!--class{
  3. Form-control: Set the width to 100% but we set the navbar-form in the parent element form so that the width gets some control.
  4. }-->
  5. <input type="Text" class="Form-control" placeholder= "Search" />
  6. </div><!--form Groups --
  7. <button Type="Submit" class="btn btn-default"> search </button >
  8. </form><!--forms --

Drop-down menu

  1. <li Class="dropdown">
  2. <!--class{
  3. Dropdown-toggle: Declare this to be a drop-down list. In fact, I didn't find the specific purpose of this class. Canceled and no bugs found
  4. span. caret{
  5. An icon of a small triangle
  6. Picture Style
  7. }
  8. }
  9. Data-toggle= "dropdown": a necessary property for introducing a drop-down menu component
  10. role= "button": Auxiliary declaration function. Declare this is a button--
  11. <a href= "#" Class= "Dropdown-toggle" data-toggle< Span class= "pun" >= "dropdown" role= "button" aria-haspopup= " True " aria-expanded=" false " > dropdown menu name <span Class= "caret" ></SPAN></A>
  12. <ul class="Dropdown-menu">
  13. <li><a href="">bootstrap</a></li>
  14. <!--class{
  15. Divider: Separator Line Style
  16. }
  17. role= "Separator": declares this element to be a divider--
  18. <li Role="Separator" class="Divider"></li>
  19. <li><a href=""> please follow the Geek tab </a></li>
  20. </ul><!-- drop-down menu--
Full content See link: http://www.gbtags.com/gb/share/5758.htm

"Fine-grained" how to create a responsive navigation bar based on Bootstrap

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.