Boilerplate Template
A boilerplate is a standard template that provides the basic structure and essential elements needed to start an HTML document. It serves as a foundation for building web pages, ensuring that you have the necessary components in place for proper rendering and functionality across different browsers.
The Purpose: To save time and ensure consistency when creating new HTML documents. By using a boilerplate, developers can focus on adding content and functionality rather than worrying about the fundamental structure of the document.
Example Boilerplate:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<header>...</header>
<main>...</main>
<footer>...</footer>
</body>
</html>
Absolute vs Relative Paths
| Type | Example | Notes |
|---|---|---|
| Absolute URL | https://example.com/assets/logo.png | Includes protocol and domain; works from anywhere. |
| Root-Relative | /assets/logo.png | Starts from website root; domain not included. |
| Relative | ../images/logo.png | Based on current file location in your project. |