0
Are html attributes specific to certain elements or they can be used for every element? In short, are they general or specific?
my fellow coders, please explain it to me with examples. Thank you so much.
9 Réponses
+ 6
Good question. If you want a full list please check out this link: https://www.w3schools.com/tags/ref_attributes.asp
The way it works is, many attributes share the same elements, but not all. Some elements have specfic attributes not shared by others, or share only a few of the same attributes. The list above though is comprehensive, so please do check it out. Cheers. 😊
+ 6
Cheers! 😊
+ 4
Depends.
For eg class and id are used on almost every tags.
But width and height attribute cant be used in form tags.
Similarly src attribute is used only for script tag.
Hope this helps ☺️☺️.
+ 4
Yes.
+ 2
In general, there are global (what you might be referring to when you say "general") attributes and non-global (for lack of a better term, or "specific" as you say) attributes. Global attributes are available for all elements while most elements also have their own special set of attributes that only work for that element (i.e. the "for" attribute for the "label" element) or might work across some elements but not others. You can find both lists at w3schools.
https://www.w3schools.com/tags/ref_standardattributes.asp
https://www.w3schools.com/tags/ref_attributes.asp
The third category is custom attributes, which you can learn more about how to make them once you have a solid foundation in the attributes that are already supplied by the language.
+ 1
Thanks my friend. it means that some are general while others are specific to certain elements? thanks again my friend.
+ 1
thank you so much MEET MEHTA and Anthony Quick
0
thanks Janning⭐
0
☺👍