HTML & CSS Interview Question #5
What is the difference between the <head> and <body> elements?
HTML Fundamentals, Structure, Semantics, Links, Images, Tables & Forms Junior Beginner
Quick Interview Answer
The head contains metadata and resources that describe or support the document, such as the title, character encoding, viewport configuration, stylesheet links, and selected metadata for search engines.
Detailed Explanation
The head contains metadata and resources that describe or support the document, such as the title, character encoding, viewport configuration, stylesheet links, and selected metadata for search engines.
The body contains the document content that forms the page interface, such as headings, paragraphs, navigation, forms, images, tables, and other visible or interactive content.
Code Example
<head>
<meta charset="UTF-8">
<title>Interview Preparation</title>
<link rel="stylesheet" href="site.css">
</head>
<body>
<h1>HTML Interview Questions</h1>
<p>Prepare for your interview.</p>
</body>