HTML Tags: HTML code is usually referred to as tags of HTML. These tags are used to mark-up the HTML elements.
These are enclosed by the two characters, i.e. <and>, which are known as angle brackets.
Normally, HTML tags come in the pairs such as <head> and </head>.
The first tag in an HTML document is the start tag and the last tag is the end tag. A developer can write the entire code within these two tags. These tags are not case sensitive, so, you can write like <b> or <B>, both have the same meaning.
HTML tags can have attributes. Attributes can give added information about the elements on your web page. The <tag> states that the browser to do something, while the attribute tells the web browser how to perform it.
If we insert the bgcolor attribute, we can tell the browser that the background color of your web page should be red,
If you create a table in HTML, you can add a border attribute to make a border in a table such as <table border="1">. The HTML attributes always come with a name/value pairs as like this: name="value".
HTML attributes are always written in the start tag of an HTML element and the value is enclosed by the quotes. There are several attributes used in HTML and some of them often used by the developers which are lang, title, size, alt, id, src, style, etc.
All HTML Elements have HTML attributes. All attributes have two parts, one is named, and the second is the value of attribute name. For More Example and information, please see below examples:
<p title="Paragraph"> Dummy Text </p>
In the above example given paragraph tab, the title names, and Paragraph is value.
- class - Specifies one or more class names for an HTML tag/element
- id - Specifies a unique id for an HTML tag/element
- style - Specifies an inline CSS style for an HTML tag / element
- title - Specifies extra information about an HTML tag / element
- src - Specifies URL about an HTML image<img src="image-name"> - in this html image tag, src is attribute.
If we are using style tag, then how to change the text from simple to attractive, see below:
<html><h1 style="text-align:center; color:red;"> Welcome Page </h1></html>
In the output of the above example, you can see the red colored text in the center of the web page, which makes your page more noticeable. So, now you can understand the significance of attributes.
By using attributes, you can enhance the value of your web page.