HTML Attributes using with tags. Attributes are always use with starting tag.
The attribute is made up of 2 parts:
‘=’ is used to set the value
” “ Value is placed inside the double quotes.
like this: attribute=”value“
<p align = "left">This is left aligned</p>
<p align = "center">This is center aligned</p>
<p align = "right">This is right aligned</p>
Its is a unique identifier, like your government identity number. It is possible to identify just that element and its content. Generally, using id attribute for Css (Cascading Style Sheet) because it’s can help us to modify specific elements and content. You will learn more about id attribute in Css course. So, For now you can avoid it.
So, what is element? You can see in below image.
and the example of id:
<p id = "para">Use this id for identify this element</p>
<p id = "para1">Use this 2nd id for identify this element</p>
The title Attribute:
This is similar to title tag. You can use this attributes with tag.
like this :
<h3 title = "Hello HTML!">Titled Heading Tag Example</h3>
title attributes work similar to title tag.
The class Attribute:
It is similar to id but generally you can see in programming or Css, developer always use Class. Class attribute works are same as id attribute. You will learn more about class in Css course, So, For now you can avoid it. The value of the attribute may also be a space-separated list of class names. For example −
class = "className1 className2 className3"
The style Attribute:
The style attribute allows you to specify Cascading Style Sheet (CSS) rules within the element.
<p style = "font-family:arial; color:#FF0000;">This is style attribute.....</p>
So, we are not learning Css here, you need to understand what is html attributes and how they can be used while formatting content.
The href Attribute:
So, tag defines hyperlink. The href attribute specifies the URL of the page the link goes to link tab.
<a href="https://skills.dihox.com/">Visit Dihox Skills</a>
You will learn more in link chapter.
The tag is used to embed an image in an HTML page. The src attribute specifies the path to the image to be displayed.
and many more attributes are available. you can check our attributes reference page.
See you in next lesson ✌🏼