HTML Basic Notes
What is HTML?
- HTML stands for HyperText Markup Language.
- It is the standard language for creating web pages and web applications.
- HTML describes the structure of a web page using markup.
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>
Common HTML Tags:
Tag | Use
<html> | Root element of an HTML page
<head> | Metadata, title, links
<title> | Title shown on browser tab
<body> | Main content of the page
<h1> to <h6> | Headings (largest to smallest)
<p> | Paragraph
<a> | Anchor (hyperlink)
<img> | Image
<ul> / <ol> / <li> | Lists (unordered, ordered, list item)
<div> | Division/container
<span> | Inline container
<br> | Line break
<hr> | Horizontal rule
Attributes in HTML:
- Attributes provide additional information about elements.
- Written in the start tag.
Example:
<a href="https://example.com">Visit</a>
<img src="image.jpg" alt="My Image" width="300">
HTML & CSS:
- HTML is for structure.
- CSS (Cascading Style Sheets) is for styling the HTML.
Best Practices:
- Always close tags properly.
- Use semantic HTML (e.g., <header>, <footer>, <main>, <section>, etc.)
- Keep code clean and indented.