HTML
HTML
Example
<!DOCTYPE html>
<html>
<head>
< tle>Page Title</ tle>
</head>
<body>
</body>
</html>
HTML Elements
The HTML element is everything from the start tag to the end tag:
<h1></h1>
<p></p>
Nested HTML Elements
HTML elements can be nested (this means that elements can contain other elements).
All HTML documents consist of nested HTML elements.
The following example contains four HTML elements (<html>, <body>, <h1> and <p>):
HTML A ributes
All HTML elements can have a ributes
A ributes provide addi onal informa on about elements
A ributes are always specified in the start tag
A ributes usually come in name/value pairs like: name="value"
Example
<a href="h ps://www.w3schools.com">Visit W3Schools</a>
Example
<img src="img_85.jpg">
The width and height A ributes
Example
<img src="img_85.jpg" width="500" height="600">
HTML Comments
<!-- Write your comments here -->
Add Comments
Example
<!-- This is a comment -->
<p>This is a paragraph.</p>
HTML Colors
HTML colors are specified with predefined color names, or with RGB, HEX, HSL, RGBA, or
HSLA values.
HTML Links
Links are found in nearly all web pages. Links allow users to click their way from page to
page.
HTML Favicon
A favicon is a small image displayed next to the page tle in the browser tab.
Example
<!DOCTYPE html>
<html>
<head>
< tle>My Page Title</ tle>
<link rel="icon" type="image/x-icon" href="/images/favicon.ico">
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
HTML Tables
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Fu erkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
HTML Lists
Inline Elements
An inline element does not start on a new line.
An inline element only takes up as much width as necessary.
This is a <span> element inside a paragraph.
Example
<!DOCTYPE html>
<html>
<head>
<style>
.city {
background-color: tomato;
color: white;
border: 2px solid black;
margin: 20px;
padding: 20px;
}
</style>
</head>
<body>
<div class="city">
<h2>London</h2>
<p>London is the capital of England.</p>
</div>
<div class="city">
<h2>Paris</h2>
<p>Paris is the capital of France.</p>
</div>
<div class="city">
<h2>Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
</div>
</body>
</html>
HTML Forms
An HTML form is used to collect user input. The user input is most o en sent to a server
for processing.
<form>
<input type="radio" id="html" name="fav_language" value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css" name="fav_language" value="CSS">
<label for="css">CSS</label><br>
<input type="radio" id="javascript" name="fav_language" value="JavaScript">
<label for="javascript">JavaScript</label>
</form>