Introduction to HTML | HTML Elements, Tags, Attributes| Difference between Elements, Tags, Attributes
1. What is HTML?
HTML stands for Hypertext Markup Language i.e it doesn’t have decision-making capabilities.
Html is a language that is used to give basic structure and layout on the website to create web pages.
It is highly compatible with almost all web browsers.
Html is used in making web apps, mobile apps, and emails(when we subscribe to a newsletter, for a marketing campaign, etc all use HTML where fonts, and images are contained and it happens through HTML.)
HTML consists of a series of elements for example <p> tag is used for paragraph, <h1> element/tag determines the largest heading in font size, etc
HTML elements tell the browser how to display and label the content such as "this is a heading", "this is a paragraph", "this is a link", etc.
A Basic HTML Document:
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>
HTML Elements:
An HTML element is defined by a starting tag, some content, and an ending/closing tag.
e.g <tagname> Content is written here </tagname>
i.e <p>This is Manas Barman</p>where, <p> is the starting tag and </p> is the ending tag.
Note: Some HTML elements have no content (like the <br> element). These elements are called empty elements. Empty elements do not have an ending tag!
HTML Tags:
In HTML, Tags are the starting and ending parts of an HTML element.
They begin with < symbol and end with > symbol. Whatever is written inside < and > are called tags.
The name of an element inside a tag is case insensitive.
That is, it can be written in uppercase, lowercase, or a mixture.
For example, the
<html>
tag can be written as<Html>
,<HTML>
, or in any other way.However, the recommended practice is to write tags in lowercase.
e.g.
<p>
&</p>
where<p>
is the starting tag and</p>
is the ending tag.HTML Attributes:
It is used to define the character of an HTML element in detail. It is always placed in the opening tag of an element.
It provides additional pieces of information to the element. Attributes take the form of an opening tag and additional info is placed inside.
e.g.
<img src="tajmahal.jpg" alt="A photo of Taj Mahal.">
where the image source (src) and the alt text (alt) are attributes of the <img> tag (image tag).
<p
align="center">This is paragraph.</p>
where align is the attribute of the
<p>
tag (paragraph tag).
Subscribe to my newsletter
Read articles from Manas Barman directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Manas Barman
Manas Barman
I am a Electrical Graduate. Also,I am a Full stack Web Developer.