HTML Elements - wordsclank.in

Wednesday 31 October 2018

HTML Elements

An HTML element is fundamental of HTML document. An HTML element is the whole thing from opening tag to the closing tag along with the content in between the tags.

1
< tag > Content here < /tag > 

Here, < tag > is starting tag and < /tag > is closing tag and Content here is the content between the tags. So the whole < tag > Content here < /tag > is an HTML element.






Nested HTML Elements :

HTML elements can contain another HTML element.

This the correct way of nesting. 

Child and Parent elements :

When you nest HTML elements it creates a child and parent relationship between the elements. Here you can see that the title tag is created in between the head tag. And head and body tag is created within the html tag. So head and body tags are the child of html tag and also title is the child of head tag.

Explanation with an example :


1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<!DOCTYPE html>
< html >
< head >
< title > HTML Elements < /title >
< /head >
< body >
< h1 > HTML Elements < /h1 >
< p >
Nested elements < br >
Empty HTML elements
< /p >
< /body>
< /html>

  •  < html > element defines the whole document. It have a opening < html > as well as a closing tag < /html >.
  • < head > and < body > tags are the child of the parent tag < html > tag.
  • < h1 > tag defines heading. It have also opening < h1 > as well as a closing tag < /h1 >.
  • Similarly < p > tag is used for paragraph.
  • < br > tag defines line break. It is an empty HTML element.

Empty HTML Elements :

An empty HTML elements are those which don't have any content. Means it ends where it start. An empty HTML elements can be closed on the opening tag. For example, < br > is an empty HTML element which defines line break. We can also write it as < /br >.





No comments:

Post a Comment