Content Inside Head Section of the html document is not displayed in the browser. Head Section contains information and supporting styles & scripts of the displayed html document.
Only content present inside the body tags are displayed in the browser.
If you type something inside head tags, it will be displayed but is considered as the worst practice. If you want something displayed to the user, provide it inside the body tags.
Use head section to add details like Title, Styles, Scripts, Meta Data, etc.
Before learning the head elements, let's take a look at HTML lines and line breaks which are used almost all the time.
The tag <hr> can be used to draw a line in HTML document.
It is used to separate content in the document, You can a live demo of HTML line below.
HTML Line Breaks
The tag <br> can be used to break the line without using paragraph tags.
In the below example, a normal line with out paragraph tag is displayed using break tag.
<p>Paragraph 1</p> <hr> <p>Paragraph 2</p> <hr> <p>Paragraph 3</p> Normal Text <br>with Line Break
Title tags defines the title of the document, it will appear at the top of the browser.
Meta Data is not displayed in the browser, it is used by search enginges, browsers and other similar web services which acesses your web page.
Most commony used Meta Data are keywords, descriptions, author, etc.
Style tags are used to specify style information of the document. Style sheets can be added using link tag or it can be specified directly inside style tags.
HTML Head Section Example
<!DOCTYPE html> <html> <head> <title>My First HTML Document</title> <meta name="keywords" content="HTML, CSS, Responsive Web Design"> <meta name="Description" content="Step by Step Web Design Tutorial"> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> </body> </html>
The Lines with out paragraph tags will be displayed next to each other. Even if you type them in two separate lines, the browser will consider them as a single line.
Browsers will automatically add some space before and after the paragraphs, the amount of space depends on the type of browser.