Learn HTML: Html elements and its usage.
"What is HTML element"
The HTML element is defined by the starting tag and ending- tag.
syntax : < tagname >
content < /tagname >
ex: <p>
content </p>
/ here <p>
is the paragraph starting tag and </p>
is the ending tag. Content should be anything it should be a nested element also.
"HTML document structure"
<html>
<head>
<title> title name </title>
</head>
<body>
<h1> This is high important heading </h1>
<h2> This is less than the h1 </h2>
<p> Hii this is a paragraph </p>
<p> This is another paragraph <br> next line </p>
</body>
</html>
" Definition of each element "
<html>
The <HTML>
tag is a "root tag" which has an ending tag also. Inside the HTML tag, we define all the elements which are called nested elements.
Note:
<html>
and<HTML>
both are accepted we can write both uppercase and lowercase letters. Recommend always use lowercase letters.
<head>
The <head>
tag is used to declare the meta information and styling. It also has an end tag. The elements inside the head tag are not visible in the browser.
<body>
The <body>
tag is used to declare all elements that are visible in the browser. All the visible elements are written inside the body. It is used to structure the webpage.
<h1>
The <h1>
tag is used for the heading(big text) and it is the most important tag. It also has an end tag.
<p>
The <p>
tag is a paragraph tag it is used to define a paragraph. It also has an end tag.
<br>
The <br>
tag is used to break the line. It is the most important tag to break a line in an HTML document.
Note:
<br>
tag is an "empty tag" because it doesn't have an end tag.
"Attributes:"
All the elements have attributes which are used to define extra formation about the element.
We can style the elements by using the attributes and we can add extra height and width and many more.
Subscribe to my newsletter
Read articles from Naresh Chandragiri directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Naresh Chandragiri
Naresh Chandragiri
I am a currently undergraduate student from computer science background. I'm currently learning full stack web development.