HTML attribute: Difference between revisions

Content deleted Content added
Reverted 1 edit by Misbah6666 (talk): Not a reliable source
Tags: Reverted nowiki added Visual edit
Line 38:
* The '''<code>class</code>''' attribute provides a way of classifying similar elements. Multiple class names can be added by separating them with spaces.<ref>{{Cite web|url=https://www.w3schools.com/html/html_classes.asp|title=HTML Classes|website=www.w3schools.com|access-date=2020-04-27}}</ref><ref>{{Cite web|url=https://www.w3schools.com/tags/att_global_class.asp|title=HTML Global class Attribute|website=www.w3schools.com|access-date=2020-04-27}}</ref> Semantically, for example, classes are used in [[microformat]]s. Additionally authors of style sheets can construct [[CSS selector|selectors]] that match elements by class for styling purposes. For example, an HTML document might use the designation <code>class="notation"</code> to indicate that all elements with this class value are subordinate to the main text of the document. Such elements might be gathered together as footnotes on a page—instead of appearing in the place suggested by their position within the HTML source. The style sheet author might also define a rule with the <code>.notation</code> selector and define the property <code>font-size: small;</code>.
* An author may use the '''<code>style</code>''' attribute to specify element-specific style rules. The '''<code>style</code>''' attribute can be used on any HTML element (it will validate on any HTML element; however, it is not necessarily useful). It is considered better practice to add the style information to a [[Style sheet (web development)|style sheet]], often accomplished with selectors that match the element class or ID. Sometimes, however, inline styles are favored where style sheets are considered too cumbersome for a simple and specific or ad hoc style specification.
* The '''<code>title</code>''' attribute is used to attach subtextual explanation to an element. In most browsers this attribute is displayed as what is often referred to as a [[tooltip]].<ref>{{Cite web |last=matt |first=dev |date=2022-10-27 |title=HTML Global Attributes - Mr Examples |url=https://mrexamples.com/html/reference/global-attributes/ |url-status=live |access-date=2023-01-24 |website=Mrexamples |language=en-US}}</ref>
 
== HTML Attribute dir: ==
The '''dir''' attribute is used to specify the direction of text within HTML elements like <nowiki><div>, <span>, <p> and many more.</nowiki>
 
There are also a few values associated with it, which are listed below:
 
'''ltr:''' The ltr attribute is used to identify languages written from left to right, like English.
 
'''rtl:''' The rtl attribute is used to identify languages written from right to left, like Arabic.
 
'''auto:''' In this case, the application (browser) makes the decision. In order to apply that directionality to the whole element, it analyzes the characters inside the element until it finds one with significant directionality.
 
== Varieties ==