Relation of Editor and Web Browser in HTML
In the context of HTML, editors and web browsers play two crucial but different roles:
1. HTML Editor:
- An editor is a software where you write and edit HTML code.
- Examples: Notepad, VS Code, Sublime Text, Atom.
- It helps developers create and save HTML files with a .html extension.
- It does not display the webpage as it will appear in a browser.
2. Web Browser:
- A browser (like Chrome, Firefox, Safari, or Edge) is used to view and interpret HTML documents.
- It reads the HTML file and renders it visually for users.
- The browser converts HTML, CSS, and JavaScript into a formatted webpage.
Relation:
You write the HTML code in an editor, and then open that file in a web browser to see how the
webpage looks and works. The browser interprets and displays the content written in the HTML file.
Fundamental Structure of an HTML Document
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Explanation of Each Part:
1. <!DOCTYPE html>:
- Declares the document type and HTML version.
- It tells the browser to render the page using HTML5.
2. <html>:
- The root element of the HTML document.
- All content goes inside this tag.
3. <head>:
- Contains meta-information about the document (not displayed on the page).
- Can include <title>, <meta>, <style>, and <link> tags.
4. <title>:
- Sets the title of the web page, shown in the browser tab.
5. <body>:
- Contains all the visible content of the web page like headings, paragraphs, images, links, etc.
This structure is essential for every HTML document to ensure proper formatting and browser
compatibility.