Home >Web Front-end >HTML Tutorial >Which attributes are not global attributes of html
Common attributes that are not HTML global attributes include src, href, alt, colspan, rowspan, disabled, checked, required and other attributes. Detailed introduction: 1. src attribute, used to specify the URL of media files such as images, audio or video, usually used for elements such as img, audio and video; 2. href attribute, used to specify the target URL of the link, usually used for a Element, used to create hyperlinks; 3. alt attributes, etc.
The operating environment of this tutorial: Windows 10 system, Dell G3 computer.
HTML is a markup language used to create web pages. It uses tags to define the structure and content of a web page. In HTML, there are some attributes called global attributes that can be applied to almost all HTML elements. However, not all properties are global properties. The following will discuss which attributes are not global attributes of HTML and list some common attributes that are not global attributes.
First of all, global attributes are attributes that can be applied to any HTML element. They provide some basic functionality and behavior that can be used to control the appearance and behavior of elements. Some common global attributes include class, id, style, title, etc. These attributes can be used on any HTML element and have the same effect.
However, not all properties are global properties. There are some attributes that can only be applied to specific HTML elements. For example, the input element has some specific attributes, such as type, value, placeholder, etc. These attributes can only be applied to the input element and not to other elements.
The following are some common attributes that are not HTML global attributes:
1. src: This attribute is used to specify the URL of media files such as images, audio, or videos. It is usually used for elements such as img, audio and video.
2. href: This attribute is used to specify the target URL of the link. It is typically used with the a element to create hyperlinks.
3. alt: This attribute is used to specify the alternative text of the image. It is commonly used on img elements to display alternative text when the image fails to load.
4. colspan: This attribute is used to specify the number of columns that the cells in the table span. It is commonly used on td and th elements for merging cells.
5. rowspan: This attribute is used to specify the number of rows spanned by cells in the table. It is commonly used on td and th elements for merging cells.
6. disabled: This attribute is used to disable the form element. It is usually used for elements such as input, select, and button to prevent users from interacting with the element.
7. checked: This attribute is used to specify whether the check box or radio button is selected. It is usually used for input elements to set the default selected state.
8. required: This attribute is used to specify whether the form element is required. It is typically used on input elements to validate user input.
The above attributes are just a small number of common attributes that are not HTML global attributes. There are many other attributes like width, height, max, min, step, etc. which can only be applied to specific HTML elements.
To summarize, HTML global attributes are attributes that can be applied to almost all HTML elements. They provide some basic functions and behaviors. However, not all properties are global, and some properties can only be applied to specific HTML elements. When writing HTML code, we need to pay attention to the scope of application of attributes to ensure correct use and effective control of the appearance and behavior of elements.
The above is the detailed content of Which attributes are not global attributes of html. For more information, please follow other related articles on the PHP Chinese website!