The Bootstrap responsive navigation code changes from 768px to 992px and 768px992px

Source: Internet
Author: User

The Bootstrap responsive navigation code changes from 768px to 992px and 768px992px

If you don't talk much about it, paste the Code directly. The specific code is as follows:

<! -- Responsive navigation --> 

This is an example I followed. According to the first comment above, the button defines the class navbar-toggle. One of navbar-toggle's styles is media query.

//bootstrap.css @media (min-width: 992px) {  .navbar-toggle {   display: none;  } } 

Then I checked the navbar. less file. Found

// Navbar. less. navbar-toggle {position: relative; float: right; margin-right: @ navbar-padding-horizontal; padding: 9px 10px ;. navbar-vertical-align (34px); background-color: transparent; border: 1px solid transparent; border-radius: @ border-radius-base; // Bars. icon-bar {display: block; width: 22px; height: 2px; border-radius: 1px ;}. icon-bar +. icon-bar {margin-top: 4px;} @ media (min-width: @ grid-float-breakpoint) {// @ grid-float-breakpoint display: none ;}} // variables. less @ grid-float-breakpoint: @ screen-sm-min; // if you want to change it to 992px, use this @ grid-float-breakpoint: @ screen-md-min; // -------- @ screen-sm: 768px; @ screen-sm-min: @ screen-sm; @ screen-md: 992px; @ screen-md-min: @ screen-md; @ screen-desktop: @ screen-md-min; // Large screen/wide desktop // Note: deprecated @ screen-lg and @ screen-lg-desktop as of v3.0.1 @ screen-lg: pixel PX; @ screen-lg-min: @ screen-lg; @ screen-lg-desktop: @ screen-lg-min;

Therefore, if you want to modify the default fold breakpoint, convert the above Media query variable @ grid-float-breakpoint: @ screen-sm-min;

You can also customize a breakpoint variable to change it to another breakpoint defined by Bootstrap. Then re-compile it into a css file.

Note: It is best to copy variables. less as _ variables. lss. Copy navbar. less _ navbar. less. Then, modify the copied file. Finally, copy bootstrap. less to _ bootstrap and import it.

//__bootstrap.less //@import "navbar.less";  @import "_navbar.less"; //@import "variables.less"; @import "_variables.less"; 

After modification, compile the custom _ bootstrap. less file.

The above is the implementation code of Bootstrap responsive navigation changed from 768px to 992px. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

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.