Misunderstanding of Bootstrap drop-down menu

Source: Internet
Author: User


Bootstrap drop-down menu HTML is written in two ways:

First, built-in:

<div class= "dropdown" > <button class= "btn btn-primary" data-toggle= "dropdown" > Drop-down menu <span class= "Caret" ></span> </button> <ul class= "Dropdown-menu" > <li><a href= "#" > First Page </a></li> <li><a href= "#" > Info </a></li> <li><a href= "#" > Product < ;/a></li> <li><a href= "#" > About </a></li> </ul></div>

Second, the external type:

<button class= "Btn btn-primary"  data-toggle= "dropdown"  data-target= "#dp" >     drop-down menu <span class= "caret" ></span></button ><div class= "dropdown"  id= "DP" >    <ul class= "Dropdown-menu" >        <li><a href= "#" > Home </a></li>         <li><a href= "#" > News </a></li>         <li><a href= "#" > Products </a></li>         <li><a href= "#" > About </a></li>     </ul></div> 

The peripheral button must indicate the Data-target property, which must be marked with the # number, whose ID value must be the ID of the outer div of Class dropdown, and the menu cannot pop up if it is written to the pop-up part of the Ul.dropdown-menu. built-in can be added without the Data-target attribute, if the addition must be in accordance with the external requirements of the addition, otherwise it will not bounce out


In addition: JS writing is not recommended, prone to problems


This article from the "front-end Development Study Notes" blog, declined reprint!

Misunderstanding of Bootstrap drop-down menu

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.