An HTML element consists "start tag" and "end tag"
Syntax:
<p>My Name is John</p>
Here <p> is start tag & </p> is end tag
Example:
<!DOCTYPE html>
<html>
<body>
<p>My Name is Rathorji</p>
</body>
</html>
Output:
My Name is Rathorji |
Empty HTML Elements
The Element which has no content is called an empty element.
<br> is an empty element without a closing tag
example:
<!DOCTYPE html>
<html>
<body>
<p>My Name is<br> Rathorji</p>
</body>
</html>
output:
My Name is Rathorji |
Nested HTML element
In some cases that an HTML element can contain one or more elements.
Let’s see the below example for a better understanding.
<html>
<body>
<p><strong>This is a paragraph</strong></p>
</body>
</html>
output:
This is a paragraph |
<script> Element
The <script> element is used to specify JavaScript document in HTML.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Page Title</title>
</head>
<body>
<script>
document.write("<p>Hello World!</p>")
</script>
</body>
</html>
Output:
Hello World! |