HTML, the markup language for creating net pages, has a wide range of attributes that present functionalities and outline completely different features of components on an online web page. Some distinctive or much less generally recognized attributes embrace:
1) contenteditable: This attribute makes the content material of a component editable by the person. It may be utilized to varied HTML components like
<span> to permit direct person enter.
<div contenteditable="true"> This content material may be edited by the person. </div>
<img src="https://style-tricks.com/margishpatel/picture.jpg" draggable="true" alt="Drag me">
3) hidden: This attribute hides the ingredient from being displayed. It is completely different from CSS show: none; because it fully removes the ingredient from the doc’s structure circulation.
<p hidden>This paragraph is hidden</p>
4) obtain: Used with
<a> components, it prompts the person to obtain the linked useful resource moderately than navigating to it. When clicked, it initiates the obtain of the desired useful resource.
<a href="https://style-tricks.com/margishpatel/myfile.pdf" obtain>Obtain PDF</a>
5) spellcheck: This attribute, when included in an editable ingredient, allows or disables spell checking for the content material inside that ingredient.
6) sandbox: Primarily used with
<iframe> components, it restricts what the embedded content material can do (corresponding to stopping scripts, kind submission, or same-origin restrictions) for added safety.
<iframe src="https://instance.in" sandbox="allow-scripts"></iframe>
7) loading: This attribute controls how the browser hundreds an exterior useful resource laid out in components like
<script>, and so on. It helps enhance web page efficiency by specifying lazy loading or keen loading of assets.
<img src="https://style-tricks.com/margishpatel/picture.jpg" loading="lazy" alt="Lazy-loaded picture">
8) defer: Used with the
<script> ingredient, the defer attribute ensures that the script will likely be executed after the doc has been parsed.
<script defer src="https://style-tricks.com/margishpatel/myscript.js"></script>
9) async: Just like defer, the async attribute is used with the
<script> ingredient, but it surely signifies that the script ought to be executed asynchronously.
<script async src="https://style-tricks.com/margishpatel/myscript.js"></script>
10) Translate: This attribute is used to specify whether or not the content material of a component ought to be translated when the web page is localized.
<p translate="no">This content material shouldn't be translated.</p>
Whereas these attributes present extra functionalities, it is important to make use of them appropriately and think about browser compatibility and accessibility issues when implementing them in net tasks.
Hope you prefer it.
That’s it — thanks.
To learn my different articles click on right here.
👋Hey there, Let’s join on: