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.
Note: A personal piece of advice, buy this book that will help you to get insights into HTMLHTML Attributes
: 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.
For example, if we insert the bgcolor attribute, we can tell the browser that the background color of your web page should be red, like this: <body bgcolor="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 name and second is value of attribute name. For More Example and information, please see below examples:
<p title="Paragraph"> Dummy Text </p>
In above example given paragraph tab, title is name 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:
<h1 style="text-align:center; color:red;"> Welcome Page </h1>
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.