All about programming :)

Thursday, November 26, 2020

Structure of HTML code

 


Here we will learn about the basic syntax of HTML code. So the basic syntax of HTML code is...                                            


<!DOCTYPE HTML>                                      
<html>                                               
<head>                                               
<title> My page </title>                     
</head>                                              
<body>                                               
<h1> This is heading.</h1>                   
<p>Hello, How are you?</p>                   
</body>                                              
</html>                                              


Here, <html>, <p>, <head> etc are tags. Tags are simple elements that are enclosed in angled brackets. Each element has opening and closing tags and content in between these two tags. i.e.


                 <element-name> ...................Content....................... </element-name>


There are also some HTML elements that do not have any closing tags. These elements are called void elements. The only type of data that void elements are allowed to have are attributes. For example <br />, <hr  /> , <col>, <img> etc.

In syntax DOCTYPE helps the browser to understand the version of HTML. DOCTYPE declarations are not HTML tags. <html> tag open the page. That means there should not be any tag used after closing html tag. <head> opens head section, which usually does not appear in main browser window but it contain page title name, information about HTML document, called meta data. It can import some styling sheets and scripts and in head tag you can also add favicons, icons.

                                            <title> contain title of your HTML document that you want to appear at top. It does not show title on browser main window but on title bar. <body> have all content that a user can see or access. You can use different tags, style attributes in this tag. This content is visible on browser's main window.

No comments:

Post a Comment

Structure of HTML code

  Here we will learn about the basic syntax of HTML code. So the basic syntax of HTML code is...                                            ...