14 Global HTML Attributes, You Should Know

Meghanath Aviligonda
3 min readMay 29, 2023

These global attributes are attributes that can be used with all HTML Tags.

1.class : Class refers one or more class names for an element.

.paragraph{
color:gray;
}
<p class="paragraph ">Class information</p>

2.contenteditable : If user want edit the content of an element is editable.

we can use contenteditable attribute

<h2 contenteditable="true">This is an editable heading.</h2>

3.data-* : Use the data-* attribute to embed custom data:

<h2 data-color="pink">Custom attribute</h2>

4.dir : dir attribute refers the direction of the content inside the element

<p dir="rtl">Write this text right-to-left!</p>

5.draggble: The draggble attribute specifies whether an element is draggable or not.

<h2 draggable="true">This is heading</h2>

6.hidden :The hidden attribute is used to indicate that the content of an element should not be presented to the user.

<h2 hidden>This heading should be hidden.</h2>

7.id :Specifies a unique id for an element

<h2 id="heading">This is id element</h2>

--

--

Meghanath Aviligonda

I am frontend developer. I am working technologies HTML, CSS, JavaScript, Angular, React and some other tools