HTML Element

Basically ,an HTML element is a starting and ending tag with its attribute and everything in between.

Example:

<p>Welcome to tutorials art</p>

The whole above written code is html element beginning from starting tag and ending at end tag with content written in between.

Element types

As we have discussed what the HTML element is, Now we will discuss some basic types of HTML element :

  • Empty Element
  • Nested Element

Empty Element

There is no content in some elements such elements are known as empty elements and there is no end tag for such elements. Basically, These elements have only started tag and have no data presented in between.

Example:

<br>,<img>,<li> are some examples of empty tag.

<p>hello <br> welcome to tutorials art</p>

Nested Element

Nesting is called putting one element inside the other, So the elements can be used inside the other element. The one element which is use inside other element is known as child element and the other element is known as Parent element if the elements are nested within it.

Example

<html>
<head>
<title>Nested Example</title>
</head>

<body>
<p>This is <b>bold</b> text</p>
</body>
</html>
HTML Element

<b> tag is nested within <p>.

Note: Html tags should be nested in correct order such that the tag opened first must be closed first.

We have some other type of elements with respect to display values:

  1. Block element: A block element always start on a new line and take full available width. The block level element can contain other block and inline elements within it. For example <div>,<footer>,<form>
  2. Inline element: A block element does not start on a new line and take only necessary width. The inline elements can contain data and other inline elements within it. For example <span>,<b>,<var>.

Note: The inline elements cannot contain block elements within it but block level can contain inline elements within it.

Visit Block and inline elements to study in detail about types of element w.r.t display values.

Comments are closed.