html_documentation
html_documentation
What is HTML?
HTML is the backbone of web pages, allowing developers to structure content using elements like
headings, paragraphs, lists, tables, forms, and media HTML Elements and Features Guide
1. Input Elements
HTML provides various types of input elements that allow users to enter data in a form. These
elements help in gathering user informa on through different input methods.
Tag Description
Tag Descrip on
Input Types:
<form>
</form>
2. Tables
Tables in HTML help in structuring data in a tabular format. They consist of rows and columns
defined using <table>, <tr> (table row), <th> (table header), and <td> (table data).
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
<tr>
<td>Alice</td>
<td>25</td>
<td>New York</td>
</tr>
<tr>
<td>Bob</td>
<td>30</td>
<td>Chicago</td>
</tr>
</table>
3. Forms
Forms help in collec ng user data and sending it to the server. The <form> tag is used to create
forms, and the ac on a ribute specifies the script that processes the form.
</form>
Bu ons trigger ac ons such as form submission or JavaScript func ons. The onclick event is used to
perform an ac on when a bu on is clicked.
5. Links
Links are created using the <a> tag to navigate between pages or open external resources.
Shapes can be created using CSS by se ng the width, height, and border proper es.
<div style="width: 0; height: 0; border-le : 50px solid transparent; border-right: 50px solid
transparent; border-bo om: 100px solid green;"></div> <!-- Triangle -->
<div style="width:200px; height:100px; background-color:purple;"></div> <!-- Rectangle -->
7. Image
Images are inserted using the <img> tag with a ributes like src (source URL) and alt (alterna ve text).
Block elements take up the full width available, while inline elements take up only as much width as
necessary.
1. Block-Level Elements
Defini on:
A block-level element starts on a new line and takes up the full width available, stretching
from le to right. It always begins a new "block" in the document structure.
Common Block Elements:
Tag Descrip on
<ol> Defines an ordered list. <li> Defines a list item inside <ul> or <ol>.
2. Inline Elements
Defini on:
An inline element does not start on a new line and only takes up as much width as
necessary. It does not force a line break and remains within the flow of surrounding text.
Tag Descrip on Tag Descrip on
<em> Emphasizes text (italic). <b> Makes text bold (non-seman c).
9. Dropdowns
<select>
</select>
10. Lists
Ordered List:
<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>
Unordered List:
<ul>
<li>Item A</li>
<li>Item B</li>
</ul>
Drag and drop func onality allows users to move elements across the page using JavaScript event
handlers.
<script>
func on allowDrop(event) {
event.preventDefault();
func on drag(event) {
event.dataTransfer.setData("text", event.target.id);
func on drop(event) {
event.preventDefault();
event.target.appendChild(document.getElementById(data));
</script>
Web storage is more secure, and large amounts of data can be stored locally, without affec ng
website performance.
Unlike cookies, the storage limit is far larger (at least 5MB) and informa on is never transferred to
the server.
Web storage is per origin (per domain and protocol). All pages, from one origin, can store and access
the same data.
Web storage allows storing data locally in the browser using localStorage or sessionStorage.
<script>
localStorage.setItem("username", "JohnDoe");
document.write(localStorage.getItem("username"));
</script>
When execu ng scripts in an HTML page, the page becomes unresponsive un l the script is finished.
A web worker is a JavaScript that runs in the background, independently of other scripts, without
affec ng the performance of the page. You can con nue to do whatever you want: clicking, selec ng
things, etc., while the web worker runs in the background.
Web Workers allow running JavaScript code in the background without affec ng UI performance.
<script>
document.getElementById("output").innerHTML = event.data;
};
</script>
<p id="output"></p>
This documenta on provides explana ons and examples for various HTML elements and
func onali es to assist developers in understanding and implemen ng them effec vely.