-
Hajipur, Bihar, 844101
<head>
in HTML?The <head>
tag is a container for metadata and is placed before the <body>
tag. It holds information about the web page such as title, character set, styles, scripts, and more. Content inside <head>
does not appear visually on the web page.
<!DOCTYPE html>
<html>
<head>
<!-- Metadata goes here -->
</head>
<body>
<!-- Page content goes here -->
</body>
</html>
<head>
Tag | Purpose |
---|---|
<title> |
Sets the title in browser tab |
<meta> |
Provides metadata like description, author, charset |
<link> |
Links external resources like CSS or favicon |
<style> |
Adds internal CSS |
<script> |
Adds or links JavaScript |
<base> |
Sets a base URL for all relative URLs in the document |
<title>
– Sets the page title<title>My Awesome Website</title>
<meta>
– Adds metadata<meta charset="UTF-8">
<meta name="description" content="A beginner’s guide to HTML">
<meta name="author" content="John Doe">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link>
– Links external resources (e.g., CSS, favicon)<link rel="stylesheet" href="style.css">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<style>
– Internal CSS<style>
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
}
</style>
<script>
– JavaScript<script>
console.log("Welcome to my website!");
</script>
Or external:
<script src="script.js"></script>
Q1. Add a <title>
tag to your HTML document.
Q2. Include a <meta>
tag to set UTF-8 character encoding.
Q3. Write a <meta>
tag with a page description.
Q4. Link a CSS file called main.css
using <link>
.
Q5. Use <style>
inside the <head>
to change body text color.
Q6. Insert JavaScript code using <script>
to display an alert.
Q7. Set a favicon with <link rel="icon">
.
Q8. Use <meta name="viewport">
for responsive design.
Q9. Create a <head>
section with all standard tags.
Q10. Add a <base>
tag to set the base URL for your links.
Q1: What is the main purpose of the <head> tag?
Q2: Which tag defines the title shown in the browser tab?
Q3: What does <meta charset="UTF-8"> do?
Q4: What tag is used to link an external CSS file?
Q5: Which tag is used to set a favicon?
Q6: Where should the <head> tag appear?
Q7: What tag sets responsive behavior for mobile devices?
Q8: Which of the following tags is not usually placed in <head>?
Q9: Which tag is used to embed internal CSS styles?
Q10: What does <script src="app.js"> do?