Monday, May 15, 2017

Html Elements

Hello!...Morning guys,this morning am gonna be talking about HTML elements....In the last two tutorials we had, i talked about HTML tags, in this tutorial you gonna find out the actual difference between HTML tag and HTML element.
A HTML element is defined by a starting tag. If the element contains other content, it ends with a closing tag,where the element name is proceded by a forward slash as shown below.

START TAG                          CONTENT             END  TAG

     <P>                               paragraph content               </p> 
           
     <h1>                                      content                       </h1>

     <nav>                           navigation content              </nav>

     <br />

So here <P> and </p> is a HTML element,also <h1> and </h1> is another HTML element.There are some HTML elements which dont need to be closed such as <br />, <hr /> and <img /> elements.These are known as void elements.

HTML documents consist of a tree of these elements and they and specify how HTML documents should be built, and what kind of content should be placed in what section of the document.

Now am gonna give a brief  difference between a HTML element and a HTML tag below

HTML Element VS HTML Tag
A HTML element is defined by a starting tag.If the element contains other content,it then ends with a closing tag eg <h1> is the starting tag of the heading 1 and </h1> is the closing tag of the same heading 1 but <h1>This is the heading 1</h1>  is a heading1 element.

Nested HTML Elements
I know you must be wondering what i mean by nested HTML element.What i mean by nested HTML element is placing a HTML element inside another HTML element and it is very much allowed in HTML.

Example
<!doctype html>
<html>
<head>
<title>Nested HTML element</title>
</head>
<body>
<p>This tutorial is brought to you by<i> wed design tutorialz</i></p>
<p>This is <u>underlined</u></p>
</body>
</html>

In the above example the first paragraph is italic and the second paragraph is underlined..you can try that out using your text editor.Thts it for this tutorial,bye for now.

Links to previous tutorials on HTML : Html IntroductionHtml TagsHtml Document StructureThe Doctype Declaration , Html Basic Tags , Html Basic Tags2


Share:

0 comments:

Post a Comment