Basic HTML Page Creation
-
This lesson teaches how to create a basic HTML page from scratch, including file creation, HTML structure, and viewing the page in a browser.
๐ง What Does โBasic Page Creationโ Mean?
Creating a basic HTML webpage means combining everything youโve learned so far into one complete file.
It includes:
โ HTML structure
๐งฉ Think of it as assembling all lego blocks into one house ๐
โ Tags & elements
โ Attributes
โ Best practices
๐งฑ Basic HTML Page Structure
Every HTML page follows this standard structure:
Basic HTML Page
This is a simple HTML webpage that displays a heading, a paragraph, an image, and a link, demonstrating the basic structure of an HTML document.
<!DOCTYPE html>
<html>
<head>
<title>My Simple Webpage</title>
</head>
<body>
<h1>Hello Everyone!</h1>
<p>This is my first webpage using HTML.</p>
<img src="image.jpg" alt="Sample Image">
<a href="https://example.com">Visit Example</a>
</body>
</html>
๐ Explanation
โ <!DOCTYPE html>
<!DOCTYPE html>
๐ Tells the browser:
โThis page is written in HTML5โ
โ Always written at the top
โ No closing tagโ <html> Tag
<html>
๐ The root element of the webpage
๐ Wraps everythingโ <head> Section
<head>
<title> My Simple Webpage </title>
</head>
๐ง Contains page information (not visible on page)
โ <title> โ Text shown on the browser tab
โ <body> Section
<body>
๐ Contains everything visible on the webpage:
โ Text
โ Images
โ Links
โ Headingsโ Heading Element
<h1> Hello Everyone! </h1>
๐ Main title of the webpage
๐ Most important headingโ Paragraph Element
<p>This is my first webpage using HTML</p>
๐ Used for normal text content
โ Image Element
<img src="image.jpg" alt="Sample Image">
๐ Displays an image
๐ src โ image location
๐ alt โ image description (SEO & accessibility โ )โ Link (Anchor) Element
<a href="https://example.com"> Visit Example </a>
๐ Creates a clickable link
๐ href โ destination URL
๐ What You Have Used in This Page
โ Structure โ html, head, body
โ Elements โ h1, p, img, a
โ Attributes โ src, alt, href
โ Best practices โ Proper structure, lowercase tags๐ง Best Practices to Remember
โ Always use <!DOCTYPE html>
โ Use lowercase tags
โ Indent code properly
โ Always add alt for images
โ One <h1> per page (recommended)โจ This is the first milestone in web development
๐ HTML mastered ? CSS & JavaScript become easy!
โจ Every big website starts with a simple HTML page like this
๐ง What Are HTML Comments?
HTML comments are notes written inside HTML code that are:
โ Visible to developers
โ Invisible to users (browser does not display them)๐งฑ Syntax of HTML Comments
<!-- This is a comment -->
โ Starts with <!--
โ Ends with -->
โ Content inside is ignored by the browserโ Example
<!-- This is a heading -->
<h1>Welcome to My Website</h1>
๐ The browser will show:
Welcome to My Website
โ The comment is only for developers
๐ Comments Are Not Displayed
<p>Hello World</p>
<!-- <p>This paragraph is hidden</p> -->
๐ Output:
โ Only Hello World is shown
โ Second paragraph is hidden because it's commented๐งฉ Multi-Line Comments
HTML comments can span multiple lines:
<!--
This is a multi-line comment
Used to explain large code blocks
Very helpful for beginners
-->