The <head> element is a container for metadata (information about information) and it is use between the <html> tag and the <body>tag. metadata is information about the HTML archive.

Blog Header
Blog Header – Basic Engineer

Metadata isn’t shown meta in display. metadata define the document title, character set, styles, links, scripts etc.

HTML 4.01 the head element is mandatory but HTML 5 head element is not mandatory.

Syntax

<html>
<head>
<title> JSP </title>
</head>
<body> hello </body>
</html>

The <head> tags include the following elements:

  • title
  • style
  • base
  • link
  • script
  • meta
The <head> tags include the following elements:

Title tags :- Describes briefly what the document is about.

<head><title>overview java</title> </head

Style tags :- Group of class definitions (style sheets) used by other tags to set visual characteristics


<html>
 
<head>
    <style>
        body {
            background: red;
        }
         
        p {
            color: pink;
        }
    </style>
</head>
<body>
<p>welcome to html</p>
</body>
</html>

Base tags :- This tag is defines an absolute URL for all relative URL.

<html>
<head>
<base href = "https://basicengineer.com/overview-of-css-for-begineer/">
<body>
<p>welcome to html</p>
</body>
</head>
</html>

link tags :- Defined using the “HTML link tag” designates resources related to the actual document.

<html>
<head>
<link rel = "stylesheet" type= "text/css" href = "style.css">
<body>
<p>welcome to html</p>
</body>
</head>
</html>

Script tags :- Set of functions declared inside the “HTML script element” to provide functionality to the document.

Meta tag :- Declared through the “HTML meta tag”, set custom attributes and values for the document.

<meta charset="UTF-8">
<meta name="description" content=basicengineer>
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="sapna">

BODY Tags

The body is the container for the visual part of a document. All the things written here (except for special cases) will be shown when the document preparation is over. Most of the tags in HTML can be insert in the body section (inside the HTML body element) and will shape the visual aspects of the document. This tag is use to represent the over all content of web page.

Syntax

<html>
<head> </head>
<body>Body Contents</body>
</html>

Attribute of Body tags

  • Bgcolor :- change the background color of web page
<html>
<body style="bgcolor:pink">
    <h1>Basic Engineer/h1>
<p>This is paragraph Tag</p>
</body>
</html>
  • Txt :- change the text color of web page.
  • Background :- insert background-image on web page.
<html>
<body style="background-color:bule">
    <h1>Basic Engineer/h1>
<p>This is paragraph Tag</p>
</body>
</html>
  • Vlink :- change the color of visited link.
<html>
<head>
</head>
<body>

<p><a href="https://app.diagrams.net/">diagram</a></p>
<p><a href="https://spinbot.com/">Spinbot</a></p>

</body>
</html>
  • Alink :- change color of active link.
  • Link :- change the color of link.
  • br :- generate the new line.
<html>
<body style="background-color:bule">
    <h1>Basic Engineer/h1>
<p>This is <br> paragraph Tag</p>
</body>
</html>
example of body tag
Example

Comments

The comment tag is used to insert comments in the source code. Comments are not displayed in the browsers. We can use comments to explain our code, which can help us when we edit the source code at a later date. This is especially useful if we have a lot of code.

Comment tags start <! and end with > . Each comment can contain as many lines of text as we like. If the comment runs over a number of lines, each must start with – – and must not contain – – within its body.

Syntax

<!---- Comment here  ---->

For Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!---I love india -->
    <h1>comment tag </h1>
</body>
</html>

Output

To know more about HTML element please check Wikipedia link Click here

If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below or write us on info@basicengineer.com for more details. See you guys in another article. 

Stay Connected Stay Safe. Thank you.


Basic Engineer

Hey Readers! We have more than fifteen years of experience in Software Development, IoT, Telecom, Banking, Finance and Embedded domain. Currently we are actively working on Data Science, ML and AI with multiple market leaders worldwide. Happy Reading. Cheers!

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *