How to define information about the document using HTML ?
Last Updated :
23 Dec, 2020
The <head> tag in HTML is used to define the head portion of the document which contains metadata related to the document. This tag can contain other head elements such as <title>, <meta>, <link>, <style>, <link> etc.
The <head> element was mandatory In HTML 4.01, but it can be omitted in the current HTML 5.
Syntax:
<head>
<title>Title of the document</title>
</head>
Attributes:
- profile: It is used to specify the URL to a document which contains one or more meta data profiles for browsers to clearly understand the information.
Example 1:
HTML
<!DOCTYPE html>
< html >
< head >
< title >
How to define information about
the document using HTML?
</ title >
</ head >
< body style = "text-align: center;" >
< h1 style = "color: green;" >
GeeksforGeeks
</ h1 >
< p >
A computer science portal
</ p >
</ body >
</ html >
|
Output:
Example 2: In this example, a CSS stylesheet named style.css is linked using the <link> tag.
CSS File:
body {
text-align: center;
}
h1 {
color: green;
}
HTML File:
HTML
<!DOCTYPE html>
< html >
< head >
< title >
How to define information about
the document using HTML?
</ title >
< link rel = "stylesheet" href = "style.css" >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< p >
A computer science portal
</ p >
</ body >
</ html >
|
Output:
Supported Browsers:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Share your thoughts in the comments
Please Login to comment...