HTML Notes by IronCoding
HTML Notes by IronCoding
HTML Notes by IronCoding
HTML
Hyper Text Markup Language HTML is the code that is used to structure a web page and its
content.
The component used to design the structure of websites are called HTML tags.
HTML Tag
A container for some content or other HTML tags.
<!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>
<body>
<p> Hello world!</p>
</body>
</html>
We have to write our code between body (<body> <p> Hello world!</p> </body>) like this.
Comments in HTML
This is part of code that should not be parsed.
<section>
Article Tag For an article on your page
<article>
<aside>
Div Tag : Div is a container used for other HTML elements. Block Element (takes full width)
Span Tag : Span is also a container used for other HTML elements. Inline Element (takes
width as per size).
Lists in HTML
Unordered HTML List : An unordered list starts with the <ul> tag. Each list item starts with the
<li> tag. The list items will be marked with bullets (small black circles) by default:
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Ordered HTML List : An ordered list starts with the <ol> tag. Each list item starts with the <li>
tag. The list items will be marked with numbers by default:
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
HTML Tables
A table in HTML consists of table cells inside rows and columns.
A simple HTML table:
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
Table Cells
Each table cell is defined by a <td> and a </td> tag.
Everything between <td> and </td> are the content of the table cell.
Example
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
</table>
Table Rows
Each table row starts with a <tr> and ends with a </tr> tag.
Example
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
Table Headers
Sometimes you want your cells to be table header cells. In those cases use the <th> tag instead of
the <td> tag:
Example
Let the first row be table header cells:
<table>
<tr>
<th>Person 1</th>
<th>Person 2</th>
<th>Person 3</th>
</tr>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
Table Headers
Sometimes you want your cells to be table header cells. In those cases use the <th> tag instead of
the <td> tag:
Example
Let the first row be table header cells:
<table>
<tr>
<th>Person 1</th>
<th>Person 2</th>
<th>Person 3</th>
</tr>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
HTML Forms
An HTML form is used to collect user input. The user input is most often sent to a server for
processing.
<form action="/action.php" > Action attribute is used to define what action needs to be
performed when a form is submitted
Label
<input type="radio" value="class X" name="class" id="id1">
<label for="id1">
</label>
<input type="radio" value="class X" name="class" id="id2">
<label for="id2">
</label>
Class & Id
The class attribute is often used to point to a class name in a style sheet. It can also
be used by a JavaScript to access and manipulate elements with the specific class
name.
The id attribute specifies a unique id for an HTML element. The value of the id
attribute must be unique within the HTML document.
The syntax for id is: write a hash character (#), followed by an id name. Then, define
the CSS properties within curly braces {}.
Checkbox
<input type="checkbox" value="class X" name="class" id="id1">
<label for="id1">
</label>
<input type="checkbox" value="class X" name="class" id="id2">
<label for="id2">
</label>
Textarea
It is used for feedback boc, bio and comments etc.
Select
<option value="Delhi"> Delhi </option>
<select name="city" id="city">
</select>
<option value="Mumbai"> Delhi </option>
<option v
iframe Tag
It is used run a video or website in our web site for example we have to run a youtube
video in our website.
Video Tag
<video src="myVid.mp4"> My Video </video>
Attributes
- controls
- height
- width
- loop
- autoplay