Skip to main content

Command Palette

Search for a command to run...

Understanding HTML Attributes

Published
1 min read
B
Software Engineer (Backend Engineer) | AI Engineer

In real cases when you have an HTML element on your page, you often want to add more information to the opening tag of that element, you can achieve this with attribute.

Attributes always have the key="value" pair syntax

let's say you want to give a unique identifier to an HTML element, you can do this by adding an id attribute.

<div id="main-content">
    <p>main content</p>
</div>

You can have multiple attributes on an element but not a duplicate.

More from this blog

R

RiteChoice23

30 posts

Programming and technical education.