What are HTML Attributes?
HTML attribute describes the features of any HTML element and is placed inside the element’s opening tag. It contains extra information about elements.
Attributes Examples
The href Attribute
The <a> tag (anchor tag) is used to build a hyperlink on the webpage. The href attribute in Html stands for hyperlink reference. It defines the URL of the webpage and the link goes to:
<!DOCTYPE html> <html> <body> <h1>HTML Attributes</h1> <p>href Attribute in html</p> <a href="https://www.oixiesoft.com/">Visit Oixiesoft</a> </body> </html>
Output
The style Attribute
The style attribute permits you to determine CSS controls within the element such as font, size, and color.
<!DOCTYPE html> <html> <body> <h1 style="color:green;">HTML Attributes</h1> <p>href Attribute in html</p> </body> </html>
Output
HTML Attributes
href Attribute in html
The src Attribute
The <img> tag sets up the image in an HTML page. The src attribute describes the browser where to pull up the image from.
<!DOCTYPE html> <html> <body> <h1>src Attribute</h1> <img src="https://www.oixiesoft.com/wp-content/uploads/2022/04/Porcelain-Espresso-Cups-.jpg" width="500" height="600"> </body> </html>