HTML Attributes Explained
A simple explanation of html attributes for code newbies.
What are HTML Attributes
Attributes are an extended informational part of HTML elements that provides further description about the element.
Attributes are written as a name-value pair where the values are always written within quotes following an ‘equals to’ sign. .
The name will specify the attribute type and the value will specify the exact type of modifications or features to be applied to the element.
These attributes are positioned inside the open tag of the element and helps in providing additional features to the element.
Why Use Attributes in HTML
We use attributes in html elements to extend additional features to the elements such as change the size in terms of height or width, using the height and width attributes respectively and indicate source path of img element to display image in the page by using the src attribute inside the <img> tag and also show the url link to which the particular link in the page is linked by using the href attribute in the <a> tag.
How the Syntax is written
<tagname attribute = “value”></tagname>
Example of an Attribute
In the example provided below, we have an <img/> element containing the src attribute in the open tag of img tag and here the name of the attribute is src followed by an ‘=’ sign which is followed by the value showing the path of the image in order to display the image in the page.
<img src = " https://i.imgur.com/syLfqCo.png" />
Conclusion
You have learnt the essentials of html attributes with examples. I am preparing some cheat sheets in html code for your learning phase and will notify you once it is ready for downloading.
More of HTML knowledge: