HTML Attribute

HTML Attribute provides additional information about the HTML Elements. HTML Attributes always specified in the starting tag.
Example: <a href="https://www.nepalcodingschool.com">Visit Nepal Coding School</a>

The <a> tag denotes hyperlinks. The href is the attribute which specifies the URL of the page.

Common HTML Attributes

1. Src: It is used with <img> tag to define the path of the image to be shown

<img src="image.jpg" alt=”write a description of image”>

2. Style: It is used for adding inline CSS to an relative element

<p style="color: red">Learn Coding With Nepal Coding School.</p>

3. class: It is used to assign one or more names to any element which is used to apply CSS.

<p class="para-1"> This is the first paragraph.</p>

4. id: It is used to assign a unique name to an element for applying CSS or manipulating the element or JavaScript.

<p id="uniquename"> This paragraph has a unique id.</p>

5. lang: This attribute is used to declare the language of the web page which will assist search engines and browsers define default language.

<!DOCTYPE html>
<html lang="en">
<body>
</body>
</html>

Share this Tutorials

HTML Attribute

Or copy link

CONTENTS
Scroll to Top