Welcome to the HTML Basics Guide! If you're new to HTML or looking to refresh your knowledge, this guide will provide you with a solid foundation to start building web pages.
What is HTML?
HTML, which stands for HyperText Markup Language, is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as CSS and JavaScript.
Basic Structure
Every HTML document has a basic structure that includes the following elements:
- Doctype: This declaration defines the document type and version of HTML.
- HTML: The root element that encloses all the content of the document.
- Head: Contains meta-information about the document, such as its title and links to CSS files.
- Body: Contains the content of the document, such as text, images, links, and other elements.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Elements and Attributes
HTML elements are the building blocks of HTML pages. They are defined by tags, such as <h1>
for headings and <p>
for paragraphs. Elements can have attributes, which provide additional information about the element.
For example, the <img>
tag is used to embed images in an HTML document. The src
attribute specifies the URL of the image file.
<img src="image.jpg" alt="Description of the image">
Common HTML Elements
Here are some common HTML elements you'll use in your web pages:
<h1>
to<h6>
: Headings<p>
: Paragraphs<a>
: Links<img>
: Images<div>
: Divisions (used for layout)<span>
: Span (used for styling)
Learn More
To dive deeper into HTML, check out our comprehensive HTML Tutorial.