Day 02 What is HTML Element

What Are HTML Elements?

HTML (Hypertext Markup Language) is the backbone of web development. It allows us to create structured and interactive web pages. In this article, we’ll learn about the important aspects of HTML elements, their syntax, and best practices.

Syntax:

> Contents...

Some key points about HTML elements

1. Syntax:

  • An opening tag indicates where the content begins: .
  • A closing tag indicates where the content ends: .
  • The actual content resides between the opening and closing tags.

2. Case Sensitivity:

  • HTML tags are not case-sensitive. For example,  and  both represent bold text.
  • However, it’s a best practice to use lowercase tags for consistency.
HTML ElementDescriptions
Opening tag( )It is used to tell the browser where the content material starts.
Closing tag()It is used to tell the browser where the content material ends.
ContentIt is the actual content material inside the opening and closing tags.

Combining all these 3 parts results in an overall HTML Element.

Group-3-2

Example 1: In this example

is a starting tag,

is an ending tag and it contains some content between the tags, which form an element

HTML

 

<html> <head>    <title>HTML Elementstitle> head> <body>    <p>Welcome to our SamwithCode!p> body> html>

 

Output:

 

Nested HTML Elements

  • When an HTML element is used inside another, it’s called a nested element.
  • For instance, the  tag contains the  and  tags, forming a nested structure.

Example: This example describes the use of Nested HTML elements. Here, the tag contains the and . The and tag contain other elements so it is called a nested element.

HTML

 

<html>

<head>

<title>HTML Elementstitle>

head>

<body style="text-align: center">

 <h1>SamwithCodeh1>  

<p>Computer science portalp>

body>

html>