HTML (HyperText Markup Language) is the standard markup language for creating web pages. It describes the structure of a web page using elements, which are represented by tags.
HTML Introduction
HTML (HyperText Markup Language) is the standard language for creating web pages.
Example:
<!DOCTYPEhtml><html><head><title>Introduction to HTML</title></head><body><h1>Welcome to HTML!</h1><p>This is my first HTML page.</p></body></html>
HTML Editors
You can write HTML in editors like VS Code, Sublime, or Notepad.
Example in VS Code: Create an index.html file and type:
HTML Basic
Basic structure includes <!DOCTYPE>, <html>, <head>, and <body>.
Example:
HTML Elements
HTML elements include a start tag, content, and an end tag.
Example:
HTML Attributes
Attributes provide additional information about elements.
Example:
HTML Headings
HTML supports headings <h1> to <h6>.
Example:
HTML Paragraphs
Paragraphs are defined with the <p> tag.
Example:
HTML Styles
Inline styles can be applied using the style attribute.
Example:
HTML Formatting
Formatting tags include <b>, <i>, <u>, and <strong>.
Example:
HTML Quotations
Use <blockquote> for block quotes and <q> for inline quotes.
Example:
HTML Comments
Add comments with <!-- -->.
Example:
HTML Colors
Define colors using names, HEX, or RGB.
Example:
HTML CSS
CSS can be added inline, internally, or externally.
Example:
HTML Links
Links are created using the <a> tag.
Example:
HTML Images
Images are embedded using <img>.
Example:
HTML Favicon
Favicons are added in the <head>.
Example:
HTML Page Title
Set the page title with the <title> tag.
Example:
HTML Tables
Create tables using <table>.
Example:
HTML Lists
Create ordered and unordered lists.
Example:
HTML Block & Inline
Block elements take up full width, inline elements do not.
Example:
HTML Div
Div is a container for grouping.
Example:
HTML Classes
Use class to group elements.
Example:
HTML Id
The id attribute uniquely identifies an element.
Example:
HTML Iframes
Embed another webpage with <iframe>.
Example:
HTML JavaScript
Embed JavaScript into HTML.
Example:
HTML Forms
Forms collect user input.
Example:
HTML Canvas
Draw graphics using the <canvas> tag.
Example:
HTML Video
Embed video files.
Example:
HTML Audio
Embed audio files.
Example:
HTML Web Storage
Store data locally using localStorage.
Example:
HTML Geolocation
Get the user’s location.
Example:
HTML Drag/Drop
HTML5 provides drag-and-drop functionality using the draggable attribute.
Example:
HTML Web Workers
Web Workers allow running scripts in background threads without blocking the page.
Example:
worker.js:
HTML SSE (Server-Sent Events)
SSE allows the server to push updates to the client.
Example:
server.php (example server code):
HTML APIs
APIs integrate advanced functionality into web pages. Examples include geolocation, storage, and drag/drop.
HTML File Paths
File paths determine the location of resources like images, CSS, or JavaScript.
<head>
<meta charset="UTF-8">
<meta name="description" content="A simple HTML example">
<title>HTML Head Example</title>
<link rel="stylesheet" href="styles.css">
</head>
<style>
body {
font-size: 16px;
}
@media (max-width: 600px) {
body {
font-size: 12px;
}
}
</style>
<p>Resize the browser window to see responsive text size.</p>
<pre>
<code>
function hello() {
console.log("Hello, World!");
}
</code>
</pre>
<p>Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.</p>