Advertisement
Google Ad Slot: content-top
The Head Element
The <head> element in HTML is used to contain meta-information about the HTML document. This includes elements like the page title, links to stylesheets, character set declarations, and more.
Common Element in the <head>:
<title>: Sets the title of the webpage.<meta>: Provides metadata about the HTML document (like character encoding, author, and keywords).<link>: Links external resources like stylesheets and icons.<style>: Embeds CSS styles directly within the HTML document.<script>: Embeds or links to JavaScript code.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"> <!-- Specifies the character encoding for the document -->
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Ensures proper scaling on mobile devices -->
<meta name="description" content="A brief description of your page"> <!-- Describes the content of your page -->
<meta name="keywords" content="HTML, CSS, JavaScript"> <!-- Keywords related to your page -->
<meta name="author" content="Your Name"> <!-- The author of the document -->
<title>Your Page Title</title> <!-- The title displayed in the browser tab -->
<link rel="stylesheet" href="styles.css"> <!-- Links to an external stylesheet -->
<link rel="icon" href="favicon.ico"> <!-- Adds a favicon for your page -->
<script src="script.js"></script> <!-- Links to an external Javascript -->
<!-- Any additional meta tags, scripts, or links go here -->
</head>
<body>
<!-- Your content goes here -->
</body>
</html>