Documente Academic
Documente Profesional
Documente Cultură
TP.HCM, 27-08-2004
Table of contents :
Basic Tags
Formatting Text
Text formatting
Preformatted text (how to control line breaks and spaces)
Different computer-output tags
Insert an address...................................................................................................................6
Abbreviations and acronyms
Long and short quotations
How to mark deleted and inserted text ...............................................................................7
Links
Frames
How to create a vertical frameset with 3 different documents..........................................11
How to create a horizontal frameset with 3 different documents
How to mix a frameset in rows and columns.....................................................................12
How to create a navigation frame
Inline frame (a frame inside an HTML page)....................................................................13
Jump to a specified section within a frame
Jump to a specified section with frame navigation ...........................................................14
Tables
Simple tables
Different table borders.......................................................................................................15
Table with no borders
Headings in a table.............................................................................................................16
Empty cells
Table with a caption...........................................................................................................17
Table cells that span more than one row/column...............................................................18
Tags inside a table..............................................................................................................19
Cell padding (control the white space between cell content and the borders
Cell spacing (control the distance between cells)
Add a background color or a background image to a table...............................................20
Add a background color or a background image to a table cell.........................................21
Align the content in a table cell
The new frame attribute
Lists
An unordered list................................................................................................................22
An ordered list....................................................................................................................23
Different types of ordered lists
Different types of unordered Lists.....................................................................................24
Nested list
Nested list 2........................................................................................................................25
Definition list
Images
Insert images
Insert images from another folder or another server
Align an image within a text..............................................................................................30
Let the image float to the left/right of a paragraph............................................................31
Adjust images to different sizes.........................................................................................32
Display an alternate text for an image (if the browser can't load images)
Make a hyperlink of an image
Create an image-map, with click-able regions
Backgrounds
Styles
Document description
Document keywords
Redirect a user to another URL ........................................................................................35
1. A very simple HTML document
<html>
<body>
The content of the body element is displayed in your browser.
</body>
</html>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>
<p>
To break<br>lines<br>in a<br>paragraph,<br>use the br tag.
</p>
</body>
</html>
4. Heading tags
<html>
<body>
</body>
</html>
6. Text formatting
<html> This text is bold
<body> This text is strong
This text is big
<b>This text is bold</b> This text is emphasized
This text is italic
<br> This text is small
This text contains subscript
<strong> This text contains superscript
This text is strong
</strong>
<br>
<big>
This text is big
</big>
<br>
<em>
This text is emphasized
</em>
<br>
8. Insert an address
<html> Donald Duck
<body> BOX 555
Disneyland
<address> USA
Donald Duck<br>
BOX 555<br>
Disneyland<br>
USA
</address>
</body>
</html>
<p>
<a
href="http://www.microsoft.com/">
This text</a> is a link to a page on
the World Wide Web.
</p>
</body>
</html>
<pre>
for i = 1 to 10
print i
next i
</pre>
</body>
</html>
<p>
Most browsers will overstrike
deleted text and underline inserted
text.
</p>
<p>
Some older browsers will display
deleted or inserted text as plain text.
</p>
</body>
</html>
</body>
</html>
<p>
If you set the target attribute of a link
to "_blank",
the link will open in a new window.
</p>
</body>
</html>
Chapter 6
<a name="C4"><h2>Chapter
4</h2></a> This chapter explains ba bla bla
<p>This chapter explains ba bla
bla</p> Chapter 7
<h2>Chapter 5</h2> This chapter explains ba bla bla
<p>This chapter explains ba bla
bla</p> Chapter 8
<h2>Chapter 16</h2>
<p>This chapter explains ba bla
bla</p>
<h2>Chapter 17</h2>
<p>This chapter explains ba bla
bla</p>
</body>
</html>
<a
href="http://www.w3schools.com/"
target="_top">Click here!</a>
</body>
</html>
16. How to link to a mail message (will only work if you have mail installed)
<html>
<body>
<p>
This is a mail link:
<a href="mailto:someone@microsoft.com?subject=Hello
%20again">
Send Mail</a>
</p>
<p>
<b>Note:</b> Spaces between words should be replaced
by %20 to <b>ensure</b> that the browser will display
your text properly.
</p>
</body>
</html>
<frameset
cols="25%,50%,25%">
<frame
src="tryhtml_frame_a.htm">
<frame
src="tryhtml_frame_b.htm">
<frame
src="tryhtml_frame_c.htm">
</frameset>
</html>
<frameset rows="25%,50%,25%">
<frame
src="tryhtml_frame_a.htm">
<frame
src="tryhtml_frame_b.htm">
<frame
src="tryhtml_frame_c.htm">
</frameset>
</html>
<frameset rows="50%,50%">
<frame src="tryhtml_frame_a.htm">
<frameset cols="25%,75%">
<frame src="tryhtml_frame_b.htm">
<frame src="tryhtml_frame_c.htm">
</frameset>
</frameset>
</html>
<frameset cols="120,*">
<frame src="tryhtml_contents.htm">
<frame src="tryhtml_frame_a.htm"
name="showframe">
</frameset>
</html>
<iframe src="default.asp"></iframe>
</body>
</html>
<frameset cols="20%,80%">
<frame
src="tryhtml_frame_a.htm">
<frame src="link.htm#C10">
</frameset>
</html>
<frameset cols="180,*">
<frame src="content.htm">
<frame src="link.htm"
name="showframe">
</frameset>
</html>
</body>
</html>
</body>
</html>
<h4>Vertical headers:</h4>
<table border="1">
<tr>
<th>First Name:</th>
<td>Bill Gates</td>
</tr>
<tr>
<th>Telephone:</th>
<td>555 77 854</td>
</tr>
<tr>
<th>Telephone:</th>
<td>555 77 855</td>
</tr>
</table>
</body>
</html>
<table border="6">
<caption>My Caption</caption>
<tr>
<td>100</td>
<td>200</td>
<td>300</td>
</tr>
<tr>
<td>400</td>
<td>500</td>
<td>600</td>
</tr>
</table>
</body>
</html>
</body>
</html>
</body>
</html>
30. Cell padding (control the white space between cell content and the borders
<html> Without cellpadding:
<body>
First Row
<h4>Without cellpadding:</h4> Secon
<table border="1"> Row
d
<tr>
<td>First</td>
With cellpadding:
<td>Row</td>
</tr>
<tr> First Row
<td>Second</td>
<td>Row</td>
</tr> Secon
Row
</table> d
<h4>With cellpadding:</h4>
<table border="1"
cellpadding="10">
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
</body>
</html>
</body>
</html>
</body>
</html>
</body>
</html>
</body>
</html>
</body>
</html>
</body>
</html>
</body>
</html>
</body>
</html>
42. Checkboxes
<html> I have a bike:
<body>
I have a car:
<form>
I have a bike:
<input type="checkbox"
name="Bike">
<br>
I have a car:
<input type="checkbox"
name="Car">
</form>
</body>
</html>
43. Radiobuttons
<html> Male:
<body>
Female:
<form>
When a user clicks on a radio-button, the button
Male:
becomes checked, and all other buttons with the
<input type="radio" checked
same name become unchecked
name="Sex" value="male">
<br>
Female:
<input type="radio"
name="Sex" value="female">
</form>
<p>
When a user clicks on a radio-button, the button
becomes checked, and all other buttons with the
same name become unchecked
</p>
</body>
</html>
<form>
<select name="cars">
<option value="volvo">Volvo
<option value="saab">Saab
<option value="fiat" selected>Fiat
<option value="audi">Audi
</select>
</form>
</body>
</html>
<body> Mouse
Type your last name:
Submit
<form name="input"
action="html_form_action.asp" method="get">
If you click the "Submit" button, you will send
Type your first name: your input to a new page called
<input type="text" name="FirstName" html_form_action.asp.
value="Mickey" size="20">
<br>Type your last name:
<input type="text" name="LastName"
value="Mouse" size="20">
<br>
<input type="submit" value="Submit">
</form>
<p>
If you click the "Submit" button, you will send
your input to a new page called
html_form_action.asp.
</p>
</body>
</html>
</form>
<p>
If you click the "Submit" button, you send your
input to a new page called html_form_action.asp.
</p>
</body>
</html>
W3Schools.</h3> Comment:
Name:<br> yourcomment
<p>
An image from another folder:
<img src="/images/netscape.gif" An image from W3Schools:
width="33" height="32">
</p>
<p>
An image from W3Schools:
<img
src="http://www.w3schools.com/images/ie.gif"
width="73" height="68">
</p>
</body>
</html>
<p>
An image
<img src ="/images/xhtml.gif"
width="100" height="50">
in the text
</p>
<p>
<img src ="/images/xhtml.gif"
width="100" height="50">
An image before the text
</p>
<p>
An image after the text
<img src ="/images/xhtml.gif"
width="100" height="50">
</p>
</body>
</html>
</body>
</html>
<p>
<img src="/images/hackanm.gif"
width="20" height="20">
</p>
<p>
<img src="/images/hackanm.gif"
width="45" height="45"> You can make a picture larger or smaller changing
</p> the values in the "height" and "width" attributes of
the img tag.
<p>
<img src="/images/hackanm.gif"
width="70" height="70">
</p>
<p>
You can make a picture larger or smaller
changing the values in the "height" and "width"
attributes of the
img tag.
</p>
</body>
</html>
<p>
Click on one of the planets to watch it closer:
</p>
<img src="/images/planets.gif"
width="145" height="126"
usemap="#planetmap">
Note: We use both an id and a name attribute in
<map id="planetmap" name="planetmap"> the map tag because some versions of Netscape
don't understand the id attribute.
<area shape="rect"
coords="0,0,82,126"
alt="Sun"
href="sun.htm">
<area shape="circle"
coords="90,58,3"
alt="Mercury"
href="mercur.htm">
<area shape="circle"
coords="124,58,8"
alt="Venus"
href="venus.htm">
</map>
<p>
<b>Note:</b> We use both an <b>id</b> and a
<b>name</b> attribute in the map tag
because some versions of Netscape don't
understand the id attribute.</p>
</body>
</html>
</head>
<body>
<h1>This is header 1</h1>
<h3>This is header 3</h3>
</body>
</html>
<body>
<a href="lastpage.htm"
style="text-decoration:none">
THIS IS A LINK!
</a>
</body>
</html>
<meta name="author"
content="Jan Egil Refsnes">
<meta name="revised"
content="Jan Egil Refsnes,6/10/99">
<meta name="generator"
content="Microsoft FrontPage 4.0">
</head>
<body>
<p>
The meta attributes of this document identify the
author and the editor software.
</p>
</body>
</html>
<meta name="description"
content="HTML examples">
<meta name="keywords"
content="HTML, DHTML, CSS, XML, XHTML,
JavaScript, VBScript">
</head>
<body>
<p>
The meta attributes of this document describe the
document and its keywords.
</p>
</body>
</html>
<p>
You will be redirected to the new address in five seconds.
</p>
<p>
If you see this message for more than 5 seconds, please click on the link above!
</p>
</body>
</html>