html
html
HTML
Hypertext Markup Language
Hypertext → One page linked to another page.
Markup → Markup is used to structure and organize content for the web.
HTML (HyperText Markup Language) is the foundation of web development and
acts as the skeleton of every webpage.
Markup Language
A markup language works like a guidebook that applies rules to the text, such as:
This is a heading.
This is a paragraph.
HTML 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
HTML 2
<body>
</body>
</html>
<!DOCTYPE html>
Its purpose is to tell the browser that the document is written in HTML5 format.
This line should be at the very top of every HTML document to ensure the
browser renders it correctly.
<html lang="en">
This is the root element that wraps the entire HTML document.
Metadata is not directly visible but is essential for browsers and search
engines.
In HTML, metadata provides information about the web page that is not
displayed directly on the page but is essential for browsers, search engines,
and other tools.
HTML 3
width=device-width : Sets the page's width equal to the device's screen width.
The body is the section that contains the visible content of the web page.
HTML Tags
Tags are a fundamental part of HTML that specify content or structure.
Each tag typically consists of an opening tag and a corresponding closing tag.
Syntax
<opening-tag>Content</closing-tag>
Example:
<p>This is a paragraph.</p>
1. Self-closing Tags:
Some tags do not contain content and do not require a closing tag.
HTML 4
Creates a horizontal line
<hr> <hr />
(divider).
<area shape="rect"
Defines clickable areas in an
<area> coords="34,44,270,350" href="link.html"
image map. />
2. Attributes of tags:
HTML 5
Provides alternative text for an <img src="logo.png" alt="Company Logo"
alt
image. />
Global Attributes
These attributes can be applied to most HTML elements:
hidden Hides the element from the page. <div hidden>This is hidden.</div>
HTML 6
Custom attributes for data storage in
data-* <div data-user-id="12345"></div>
JavaScript.
HTML Elements
An HTML Element is a complete structure made up of tags and their content.
Format
<tagname attribute="value">Content</tagname>
Example:
<p class="text">This is an element.</p>
Represents a block of
<blockquote> <blockquote>"This is a quote."</blockquote>
quoted text.
HTML 7
A description in a <dl> <dt>HTML</dt> <dd>Markup language for
<dd>
description list. web pages.</dd> </dl>
Item in an ordered or
<li> <ul> <li>Item 1</li> <li>Item 2</li> </ul>
unordered list.
Preformatted text
<pre> <pre> Line 1 Line 2</pre>
(preserves whitespace).
HTML 8
Thematic grouping of <section> <h2>Section Title</h2> <p>Section
<section>
content. content.</p> </section>
<th> Header cell in a table. <table> <tr> <th>Header 1</th> </tr> </table>
Represents a row in a
<tr> <table> <tr> <td>Row 1</td> </tr> </table>
table.
<ul> Unordered list. <ul> <li>Item 1</li> <li>Item 2</li> </ul>
1. Inline Elements
They stay on the same line as the content and do not take up the full
width.
Represents a clickable
<button> <button>Click Me</button>
button.
Displays a piece of
<code> <code>let x = 10;</code>
computer code.
<data> Links a value with its <data value="12345">Product ID</data>
corresponding machine-
HTML 9
readable data.
Embeds an image in a
<img> <img src="image.jpg" alt="Image description" />
document.
Displays a measurement or
<meter> <meter value="0.7">70%</meter>
gauge.
Embeds or refers to a
<script> <script>alert('Hello');</script>
JavaScript script.
<select> Creates a drop-down list. <select> <option>Option 1</option></select>
HTML 10
Represents strong
<strong> <strong>Critical text</strong>
importance, usually bold.
<sub> Displays text as subscript. H<sub>2</sub>O
Displays text as
<sup> x<sup>2</sup>
superscript.
Represents a variable in
<var> <var>x</var> = 10
math or programming.
Headings, h1 is largest, h6 is
<h1> to <h6> <h1>Heading 1</h1>
smallest.
<p> Paragraph. <p>Paragraph text</p>
HTML 11
<ol>, <li> Ordered list with items. <ol><li>Item 1</li></ol>
HTML 12