Home  >  Article  >  Web Front-end  >  Ask a question about the link tag attribute_html/css_WEB-ITnose

I saw the following link code in the source code of a web page:

Click to view contact information

Could you please tell me about data-target and data in What does the -toggle attribute mean? I searched online for a long time and couldn't find that has these two attributes!


Reply to discussion (solution)

Zhao Liang (Bi Hai Qing Tian): This is a custom attribute. You can add custom attributes to element tags in this way, and then use these attributes of the element in JS. For example, data-target='#contact_modal' here specifies the ID of the DIV or other display element where the contact information is to be displayed. When displaying, the attribute of the A link will be taken first to know the object it specifies, and then in that object Just display the information. data-toggle='modal' means that the way to display information is a modular way that dominates the focus. Since they are writer-defined attributes, why can I know their function? That is the writing specification of custom attributes. Good writing specifications can play this role.

Customized

How to customize attributes, in CSS?

How to customize attributes, in CSS?


This is According to the HTML5 standard, you directly add an attribute to an HTML element, and the attribute name can be whatever you want. This creates a custom attribute. Although the name can be arbitrary, custom attributes are generally custom with the data- prefix

.

??jquery? For example: data-toggle="dropdown" represents??dropdown ???Reply

Thanks to everyone above for your answers.