Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Microsoft WebMatrix
Sublime Text
However, for learning HTML we recommend a text editor like Notepad (PC) or
TextEdit (Mac).
We believe using a simple text editor is a good way to learn HTML.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
All HTML documents must start with a type declaration: <!DOCTYPE html>.
The HTML document itself begins with <html> and ends with </html>.
The visible part of the HTML document is between <body> and </body>.
2- HTML Headings
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
HTML Paragraphs
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML Links
<a href="http://www.w3schools.com">This is a link</a>
HTML Images
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142"
>
Nested HTML Elements
HTML elements can be nested (elements can contain elements).
All HTML documents consist of nested HTML elements.
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
HTML Styling
Every HTML element has a default style (background color is white and text
color is black).
Changing the default style of an HTML element, can be done with the style
attribute.
<body style="background-color:lightgrey">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
HTML Formatting Elements
In the previous chapter, you learned about HTML styling, using the
HTML style attribute.
HTML also defines special elements, for defining text with a
special meaning.
HTML uses elements like <b> and <i> for formatting output,
like bold or italic text.
<p>This text is normal.</p>
<p><b>This text is bold</b>.</p>
<p><strong>This text is strong</strong>.</p>
<p><i>This text is italic</i>.</p>
<p><em>This text is emphasized</em>.</p>
<h2>HTML <small>Small</small> Formatting</h2>
<h2>HTML <mark>Marked</mark> Formatting</h2>
<p>My favorite color is <del>blue</del> red.</p>
<p>This is <sub>subscripted</sub> text.</p>
<p>This is <sup>superscripted</sup> text.</p>
Defining HTML Tables
<table style="width:100%">
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
<table border="1" style="width:100%">
HTML Lists
Block-level Elements
A block-level element always starts on a new line and takes up the full width
available (stretches out to the left and right as far as it can).
The <div> element is a block-level element.
Examples of block-level elements:
<div>
<h1> - <h6>
<p>
<form>
The most common way to add styling, is to keep the styles in separate CSS
files. But, in this tutorial, we use internal styling, because it is easier to
demonstrate, and easier for you
element { property:value; property:value }
<h1 style="color:blue">This is a Blue Heading</h1>
Internal CSS
An internal style sheet can be used to define a common style for all HTML
elements on a page.
Internal styling is defined in the <head> section of an HTML page, using
a <style> element:
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color:lightgrey}
h1 {color:blue}
p {color:green}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
External Styling (External CSS)
External style sheet are ideal when the style is applied to many pages.
With external style sheets, you can change the look of an entire web site by
changing one file.
External styles are defined in an external CSS file, and then linked to in
the <head> section of an HTML page:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color:blue;
font-family:verdana;
font-size:300%;
}
p {
color:red;
font-family:courier;
font-size:160%;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Use the HTML <head> element to store <style> and <link> elements
Use the CSS padding property for space inside the border
Use the CSS margin property for space outside the border
HTML Forms
The action attribute defines the action to be performed when the form is
submitted.
The common way to submit a form to a server, is by using a submit button.
Normally, the form is submitted to a web page on a web server.
In the example above, a server-side script is specified to handle the submitted
form:
<form action="action_page.php">
The method attribute specifies the HTTP method (GET or POST) to be used
when submitting the forms:
<form action="action_page.php" method="GET">
<form action="action_page.php" method="POST">
Drop-Down List
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
Textarea
<form action="action_page.php">
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
Keygen
<form action="action_page.php">
Username: <input type="text" name="user">
Encryption: <keygen name="security">
<input type="submit">
</form>