HTML Basic
HTML Basics covers the fundamental building blocks of a web page. In this section, you will learn how an HTML document is structured and which tags are commonly used to create content.
HTML Document Structure
Every HTML document follows a basic structure. This structure helps the browser understand how to display the content correctly.
<!DOCTYPE html> <html> <head> <title>My First HTML Page</title> </head> <body> <h1>Hello World</h1> <p>This is my first HTML page.</p> </body> </html>Try this code
Explanation of the Code
- <!DOCTYPE html> defines the document as HTML5.
- <html> is the root element of an HTML page.
- <head> contains meta information about the page.
- <title> specifies the page title shown in the browser tab.
- <body> contains all visible content.
HTML Headings
HTML headings are used to define titles and subtitles on a web page.
There are six levels of headings, from <h1> to <h6>.
HTML Paragraphs
The <p> tag is used to define paragraphs.
Browsers automatically add space before and after each paragraph.
HTML Line Break
The <br> tag is used to insert a line break.
It is an empty tag and does not have a closing tag.
Common HTML Tags
HTML Comments
HTML comments are not displayed in the browser. They are used to add notes in the code for developers.
<!-- This is an HTML comment -->
Why Learn HTML Basics?
- HTML is the foundation of all websites
- Easy to learn and beginner-friendly
- Works with CSS and JavaScript
- Required for web development