HTML Web Development Basics Guide
HTML Web Development Basics Guide
HTML
Anjan Mahanta
LCCT - International Education Institute
anjan_mahanta@[Link] 1
What’s HTML?
• HTML is a language for describing web pages.
• HTML stands for Hyper Text Markup Language.
• HTML5 is the latest standard for HTML.
• HTML5 is a cooperation between the World Wide
Web Consortium (W3C) and the Web Hypertext
Application Technology Working Group (WHATWG).
2
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
W3C
• World Wide Web Consortium (W3C)
• The World Wide Web Consortium (W3C) is an
international community that develops open standards
to ensure the long-term growth of the Web.
Start
All Programs
Accessories
Notepad
• Save again
• Open the saved file, hello_world.html in any browser
• Save again
• Open the saved file, [Link] in any browser
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>
16
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Comment
</body>
</html>
Copyright: LCCT International Education Institute :: Anjan Mahanta :: 17
HTML Line Breaks
Use the <br> tag if you want a line break (a new line)
without starting a new paragraph:
<!DOCTYPE html>
<html>
<body>
Welcome to LCCT !!
</body>
</html> 22
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Links
• The Target Attributes
<!DOCTYPE html>
<html>
<body>
<p>If you set the target attribute to "_blank", the link will open in a new browser
window/tab.</p>
</body>
</html> OUTPUT
23
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Links – The ID Attribute
• The id attribute can be used to create a bookmark inside
an HTML document
<!DOCTYPE html>
<html>
<body>
<p><a id="tips">Useful Tips Section</a></p>
OUTPUT
24
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Head
• The HTML <head> Element
• The <head> element is a container for all the head elements.
• Elements inside <head> can include scripts, instruct the
browser where to find style sheets, provide meta
information, and more.
• The following tags can be added to the head section: <title>,
<style>, <meta>, <link>, <script>, <noscript>, and <base>.
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
The content of the document......
</body>
</html> 26
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Meta Tags
• <meta> Tags - Examples of Use
• Define keywords for search engines:
<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript">
• Define a description of your web page:
<meta name="description" content="Free Web tutorials on HTML and CSS">
• Define the author of a page:
<meta name="author" content=“Anjan Mahanta">
• Refresh document every 30 seconds:
<meta http-equiv="refresh" content="30">
27
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Meta Tags
• <meta> Tags - Examples of Use
<!DOCTYPE html>
<html>
<head>
<meta name="description" content ="Free Web Toturials">
<meta name ="keywords" content="HTML, CSS, Javascript">
<meta name ="author" content ="Anjan Mahanta">
<meta charset="UTF-8">
</head>
<body> OUTPUT
<h1> My Website</h1>
<p> Some text...</p>
</body>
</html>
28
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Tables
• Tables are defined with the <table> tag
• A table is divided into rows (with the <tr> <!DOCTYPE html>
tag), and each row is divided into data cells <html>
(with the <td> tag). <body>
• td stands for "table data," and holds the <table border="1">
<tr>
content of a data cell.
<td>row 1, cell 1</td>
• A <td> tag can contain text, links, images, <td>row 1, cell 2</td>
lists, forms, other tables, etc. </tr>
<tr>
<td>row 2, cell 1</td>
OUTPUT <td>row 2, cell 2</td>
</tr>
</table>
</body>
</html>
29
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Table Header
<!DOCTYPE html>
<html>
<body>
<table border="1">
<tr>
<th>Header 1</th> OUTPUT
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
</body>
</html>
30
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Tables Without Borders
<!DOCTYPE html>
<html>
<body> OUTPUT
<h4>This table has no borders:</h4>
<table>
<tr>
<td>100</td>
<td>200</td>
</tr>
<tr>
<td>400</td>
<td>500</td>
</tr>
</table>
</body>
</html>
31
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Table Headers
• Example: <h4>Vertical headers:</h4>
<!DOCTYPE html> <table border="1">
<html> <tr>
<body> <th>First Name:</th> OUTPUT
<td>Bill Gates</td>
<h4>Table headers:</h4> </tr>
<table border="1"> <tr>
<tr> <th>Telephone:</th>
<th>Name</th> <td>555 77 854</td>
<th>Telephone</th> </tr>
<th>Telephone</th> <tr>
</tr> <th>Telephone:</th>
<tr> <td>555 77 855</td>
<td>Bill Gates</td> </tr>
<td>555 77 854</td> </table>
<td>555 77 855</td>
</tr> </body>
</table> </html>
32
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Table with Caption
• Example:
<!DOCTYPE html>
<html>
<body>
<table border="1">
<caption>Monthly savings</caption> OUTPUT
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
</body>
</html>
33
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Table cells that span more than one
row or one column
• Example:
<h4>Cell that spans two rows:</h4>
<!DOCTYPE html> <table border="1">
<html> <tr>
<body> <th>First Name:</th>
<td>Bill Gates</td>
<h4>Cell that spans two columns:</h4> </tr>
<table border="1"> <tr>
<tr> <th rowspan="2">Telephone:</th>
<th>Name</th> <td>555 77 854</td> OUTPUT
<th colspan="2">Telephone</th> </tr>
</tr> <tr>
<tr> <td>555 77 855</td>
<td>Bill Gates</td> </tr>
<td>555 77 854</td> </table>
<td>555 77 855</td>
</tr> </body>
</table> </html>
34
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Tags inside a table
• Example: </tr>
<!DOCTYPE html> </table>
<html>
</td>
<body> OUTPUT
</tr>
<table border="1"> <tr>
<tr> <td>This cell contains a list
<td> <ul>
<p>This is a paragraph</p> <li>apples</li>
<p>This is another paragraph</p> <li>bananas</li>
</td> <li>pineapples</li>
<td>This cell contains a table:
</ul>
<table border="1">
<tr> </td>
<td>A</td> <td>HELLO</td>
<td>B</td> </tr>
</tr> </table>
<tr>
<td>C</td> </body>
<td>D</td> </html>
35
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Cell Padding
• Example:
<!DOCTYPE html> <h4>With cellpadding:</h4> OUTPUT
<html> <table border="1"
<body> cellpadding="10">
<tr>
<h4>Without cellpadding:</h4> <td>First</td>
<table border="1"> <td>Row</td>
<tr> </tr>
<td>First</td> <tr>
<td>Row</td> <td>Second</td>
</tr> <td>Row</td>
<tr> </tr>
<td>Second</td> </table>
<td>Row</td>
</tr> </body>
</table> </html>
36
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Cell Spacing
• Example: <tr>
<td>First</td>
OUTPUT
<td>Row</td>
<!DOCTYPE html>
</tr>
<html>
<tr>
<body>
<td>Second</td>
<td>Row</td>
<h4>Without cellspacing:</h4>
</tr>
<table border="1">
</table>
<tr>
<h4>With cellspacing="10":</h4>
<td>First</td>
<table border="1" cellspacing="10">
<td>Row</td>
<tr>
</tr>
<td>First</td>
<tr>
<td>Row</td>
<td>Second</td>
</tr>
<td>Row</td>
<tr>
</tr>
<td>Second</td>
</table>
<td>Row</td>
</tr>
<h4>With cellspacing="0":</h4>
</table>
<table border="1" cellspacing="0">
</body>
</html>
37
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML LISTS
• The most common HTML lists are ordered and unordered lists:
38
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Ordered List
• An ordered list starts with the <ol> tag.
• Each list item starts with the <li> tag.
• The list items are marked with numbers.
EXAMPLE OUTPUT
39
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Ordered List
EXAMPLE: Numbered List OUTPUT
<!DOCTYPE html>
<HTML>
<title> Ordered List</title>
<body>
<h4> Numbered List:</h4>
<ol>
<li> Apples </li>
<li> Bananas </li>
<li> Lemons </li>
<li> Oranges </li>
</ol>
</body>
</HTML>
40
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Ordered List
EXAMPLE: Letters List OUTPUT
<!DOCTYPE html>
<HTML>
<title> Ordered List</title>
<body>
<h4> Letters List:</h4>
<ol type="A">
<li> Apples </li>
<li> Bananas </li>
<li> Lemons </li>
<li> Oranges </li>
</ol>
</body>
</HTML>
41
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Ordered List
EXAMPLE: Lower Case List OUTPUT
<!DOCTYPE html>
<HTML>
<title> Ordered List</title>
<body>
<h4> Lower Case List:</h4>
<ol type=“a”>
<li> Apples </li>
<li> Bananas </li>
<li> Lemons </li>
<li> Oranges </li>
</ol>
</body>
</HTML>
42
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Ordered List
EXAMPLE: Roman Number List OUTPUT
<!DOCTYPE html>
<HTML>
<title> Ordered List</title>
<body>
<h4> Roman Number List:</h4>
<ol type=“I”>
<li> Apples </li>
<li> Bananas </li>
<li> Lemons </li>
<li> Oranges </li>
</ol>
</body>
</HTML>
43
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Ordered List
EXAMPLE: Lowercase Roman Number List OUTPUT
<!DOCTYPE html>
<HTML>
<title> Ordered List</title>
<body>
<h4> LowercaseRoman Number List:</h4>
<ol type=“i”>
<li> Apples </li>
<li> Bananas </li>
<li> Lemons </li>
<li> Oranges </li>
</ol>
</body>
</HTML>
44
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Unordered List
• An ordered list starts with the <ul> tag.
• Each list item starts with the <li> tag.
• The list items are marked with bullets.
EXAMPLE OUTPUT
45
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Unordered List
EXAMPLE: Disc Bullet List OUTPUT
<!DOCTYPE html>
<HTML>
<title> Unordered List</title>
<body>
<h4> Disc Bullet List:</h4>
<ul style="list-style-type:disc">
<li> Apples </li>
<li> Bananas </li>
<li> Lemons </li>
<li> Oranges </li>
</ul>
</body>
</HTML>
46
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Unordered List
EXAMPLE: Disc Bullet List OUTPUT
<!DOCTYPE html>
<HTML>
<title> Unordered List</title>
<body>
<h4> Disc Bullet List:</h4>
<ul style="list-style-type:disc">
<li> Apples </li>
<li> Bananas </li>
<li> Lemons </li>
<li> Oranges </li>
</ul>
</body>
</HTML>
<!DOCTYPE html>
<HTML>
<title> Nested List</title>
<body>
<h4> A Nested List:</h4>
<ul>
<li> Coffee </li>
<li> Tea
<ul>
<li> Green Tea</li>
<li> Black Tea</li>
</ul>
</li>
<li> Milk</li>
</ul>
</body>
</HTML>
48
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Nested List - 2
<!DOCTYPE html>
<HTML> OUTPUT
<title> Nested List</title>
<body>
<h4> A Nested List:</h4>
<ul>
<li> Coffee </li>
<li> Tea
<ul>
<li> Green Tea</li>
<ul>
<li> Chinese </li>
<li> African </li>
</ul>
</li>
</ul>
<li> Milk</li>
</ul>
</body>
</HTML>
49
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
Description List
• A description list is a list of terms/names, with a description of each
term/name.
• The <dl> tag defines a description list.
• The <dl> tag is used in conjunction with <dt> (defines
terms/names) and <dd> (describes each term/name):
EXAMPLE OUTPUT
50
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
The HTML <div> Element
• The HTML <div> element is a block level element that can be used as a
container for grouping other HTML elements.
• It is used for document layout.
• The <div> tag defines a division or a section in an HTML document.
EXAMPLE
OUTPUT
<!DOCTYPE html>
<html>
<title> DIV Example </title>
<h1> This is an example of Div</h1>
<body>
<p>Hello! Welcome to IEI</p>
<div style="color:#0000FF">
<h1> We love to study here..</h1>
<p> We speak english..</p>
</div>
<p> Come join us!</p>
</body>
</html>
51
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
The HTML <div> Element
EXAMPLE
<!DOCTYPE html>
<html>
<title> DIV Example With Border </title>
<h1> This is an example of div with border and
alignment</h1>
<body>
<div align="center" style="border:1px solid red">
<h1> We love to study here..</h1>
<p> We speak english..</p>
</div>
<p> Come join us!</p>
</body>
</html> OUTPUT
52
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
The HTML <span> Element
• The <span> tag is used to group inline-elements in a document.
• The <span> tag provides no visual change by itself.
• The <span> tag provides a way to add a hook to a part of a text or a
part of a document.
EXAMPLE
<!DOCTYPE html>
<html>
<title>:: Example of Span ::</title>
<body>
<p> Welcome to study at the <span style="color:blue;
font-weight:bold">IEI</span>. It is the best
<span style="color:red; font-weight:bold">
internationalprogram </span>
in the north of Thailand.</p>
</body>
</html> OUTPUT
53
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Layouts
• Web page layout is very important to make your website look
good.
• Multiple columns are created by using <div> or <table>
elements.
• Most websites have put their content in multiple columns
(formatted like a magazine or newspaper).
• CSS are used to position elements, or to create backgrounds or
colorful look for the pages.
54
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Layouts
• Example
55
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Layouts
• Code :: Part I ::
<!DOCTYPE html>
<html>
<title> :: Website Layout ::</title>
<body>
<div id="container" style="width:500px">
56
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Layouts
• Code :: Part II ::
57
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Iframes
• An iframe is used to display a web page within a web page.
EXAMPLE
<!DOCTYPE html>
<html>
<title> :: Example of iframe :: </title>
<body>
<h4> iframe</h4>
<iframe src="[Link] width="500" height="300"></iframe>
</body>
</html>
OUTPUT
58
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Iframes
• Using iframe as a target for a link
EXAMPLE
<!DOCTYPE html>
<html>
<body>
</body>
</html>
OUTPUT
59
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Colors
• Colors are displayed combining RED, GREEN, and BLUE light.
• The lowest value that can be given to one of the light sources is 0 (hex 00).
The highest value is 255 (hex FF).
• Hex values are written as 3 double digit numbers, starting with a # sign.
60
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Color Name
• 140 color names are defined in the HTML
61
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Entities
• Reserved characters in HTML must be replaced with character entities.
EXAMPLE
<!DOCTYPE html>
<html>
<title> :: Example of Entities :: </title>
<body>
<h4> Entities</h4>
<p> à</p>
<p> ©</p>
OUTPUT
</body>
</html>
62
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Entities
Useful HTML Character Entities
63
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Entities
Useful HTML Character Entities
64
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Multimedia
• Multimedia on the web is sound, music, videos, movies, and
animations.
• The support for sounds, animations, and videos is handled in
different ways by various browsers.
• Multimedia files have their own formats and different
extensions like: .swf, .wav, .mp3, .mp4, .mpg, .wmv, and .avi.
65
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Plug-ins
• A helper application is a small computer program that extends
the standard functionality of the browser.
• Helper applications are also called plug-ins.
• Examples of well-known plug-ins are Java applets and Adobe
Flash Player.
• Plug-ins can be added to web pages with the <object> tag or the
<embed> tag.
66
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
The <object> Element
• The <object> element is supported in all major browsers .
• The <object> element defines an embedded object within an HTML
document.
• It is used to embed plug-ins (like Java applets, ActiveX, PDF, and Flash) in web
pages.
EXAMPLE
<!DOCTYPE html>
<html>
<title> :: Example of Plug-Ins ::</title>
<body>
<object width="500" height="300" data="[Link]"> </object>
</body>
</html>
Note : Save a file as cherry with .swf extension in the same folder as the html file
67
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
The <embed> Element
• The <embed> element is supported in all major browsers .
• The <embed> element defines a container for an external application or
interactive content (a plug-in).
• The <embed> element will validate in an HTML5 page, but not in an HTML 4
page.
EXAMPLE
<!DOCTYPE html>
<html>
<title> :: Example of Plug-Ins ::</title>
<body>
<embed width="400" height="400" src="[Link]">
</body>
</html>
Note : Save a file as cherry with .swf extension in the same folder as the html file
68
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Sounds/Audio
HTML Audio - Using <embed>
• The <embed> tag defines a container for external (non-HTML) content.
Problems
• Different browsers support different audio formats
• If a browser does not support the file format, the audio will not play without a
plug-in
• If the plug-in is not installed on the users' computer, the audio will not play
EXAMPLE
<!DOCTYPE html>
<html>
<title> :: Example of Audio ::</title>
<body>
<embed width="300" height="100" src="song.mp3">
</body>
</html>
Note : Save a file as song with .mp3 extension in the same folder as the html file
69
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Sounds/Audio
HTML Audio - Using <object>
• The <object> tag can also define a container for external (non-HTML) content.
Problems
• Different browsers support different audio formats
• If a browser does not support the file format, the audio will not play without a
plug-in
• If the plug-in is not installed on the users' computer, the audio will not play
EXAMPLE
<!DOCTYPE html>
<html>
<title> :: Example of Audio ::</title>
<body>
<object height="50" width="100" data="song.mp3"></object>
</body>
</html>
Note : Save a file as song with .mp3 extension in the same folder as the html file
70
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Sounds/Audio
The HTML5 <audio> Element
• The HTML5 <audio> tag defines sound, such as music or other audio streams.
• The <audio> element works in all modern browsers.
• MP3 file (for Internet Explorer, Chrome, Firefox 21+, and Safari)
• OGG file (for older Firefox and Opera).
EXAMPLE
<!DOCTYPE html>
<html>
<title> :: Example of Audio ::</title>
<body>
<audio controls>
<source src="song.mp3" type="audio/mpeg">
<source src="[Link]" type="audio/ogg">
Your browser doesn't support this audio format
</audio>
</body>
</html>
Note : Save a file as song with .mp3 / .ogg extension in the same folder as the html file
71
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Sounds/Audio
The HTML5 <audio> The Best Solution
• The best solution is to use the HTML5 <audio> element + the <embed> element.
• First it tries to play the audio either as MP3 or OGG. If that fails, the code "falls back"
to try the <embed> element.
EXAMPLE
<!DOCTYPE html>
<html>
<title> :: Example of Audio ::</title>
<body>
<audio controls>
<source src="song.mp3" type="audio/mpeg">
<source src="[Link]" type="audio/ogg">
<embed height="50" width="100" src="song.mp3">
</audio>
</body>
</html>
Note : Save a file as song with .mp3 / .ogg extension in the same folder as the html file
72
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Sounds/Audio
HTML Audio - Using A Hyperlink
• If a web page includes a hyperlink to a media file, most browsers will use a
"helper application" to play the file.
EXAMPLE
<!DOCTYPE html>
<html>
<title> :: Example of Audio :: </title>
<body>
<a href="song.mp3"> play the song</a>
</body>
</html>
Note : Save a file as song with .mp3 extension in the same folder as the html file
73
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Videos
HTML Video - The Best Solution
• The best solution is to use the HTML5 <video> element + the <embed> element.
EXAMPLE
<!DOCTYPE html>
<html>
<title> :: Example of Video ::</title>
<body>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4"
<source src="[Link]" type="video/ogg"
<source src="[Link]" type="video/webm"
<object data="movie.mp4" width="320" height="240"></object>
<embed src="[Link]" width="320" height="240"
</video>
</body>
</html>
Note : Save a file as movie with .mp4/ogg/webm/swf extension in the same folder as the html file
74
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML YouTube Videos
Playing a YouTube Video in HTML
<!DOCTYPE html>
<html>
<title> :: Example of YouTube Videos ::</title>
<body>
<iframe width="420" height="345"
src="[Link]
</iframe>
</body>
</html>
75
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML YouTube Videos
Playing a YouTube Video in HTML
<!DOCTYPE html>
<html>
<title> :: Example of YouTube Videos ::</title>
<body>
<embed width="420" height="345"
src="[Link]
type = "application/x-shockwave-flash">
</embed>
</body>
</html>
76
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Forms
• HTML forms are used to pass data to a server.
• An HTML form can contain input elements like text fields,
checkboxes, radio-buttons, submit buttons and more.
• A form can also contain select lists, text area, field set, legend, and
label elements.
• The <form> tag is used to create an HTML form
<form>
.
input elements
.
</form>
77
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Forms - The Input Element
• The most important form element is the <input> element.
• The <input> element is used to select user information.
• An <input> element can vary in many ways, depending on the
type attribute.
• An <input> element can be of type text field, checkbox, password,
radio button, submit button, and more.
78
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Forms - The Input Element
HTML Code
<!DOCTYPE html>
<html>
<title>:: Input Form ::</title>
<body>
<form action="#" method ="post">
First Name: <input type="text" name="first" id="first"> </br>
Last Name: <input type="text" name="last" id="last"> </br>
Password: <input type="password" name="password" id="password"> </br>
<input type= "reset" value="Clear">
<input type ="submit" value="Send">
</form>
</body>
</html>
79
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Forms - The Input Element
Form Layout Using Table
<!DOCTYPE html>
<html>
<title>:: Input Form ::</title>
<body>
<form action="#" method ="post">
<table>
<tr>
<td> First Name:</td>
<td> <input type="text" name="first" id="first"></td>
</tr>
<tr>
<td> Last Name: </td>
<td> <input type="text" name="last" id="last"></td>
</tr>
<tr>
<td> Password: </td>
<td> <input type="password" name="password" id="password"> </td>
</tr> 80
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Forms - The Input Element
Form Layout Using Table
<tr>
<td> <input type= "reset" value="Clear"> </td>
<td> <input type ="submit" value="Send"> </td>
</tr>
</table>
</form>
</body>
</html> OUTPUT
81
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Forms - The Input Element
Form Using Radio Buttons and Check Boxes
82
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Forms - The Input Element
Form Using Radio Buttons and Check Boxes - Code Part 1
<!DOCTYPE html>
<html>
<title>:: Input Form ::</title>
<body>
<form action="#" method ="post">
<table>
<tr>
<td> First Name:</td>
<td> <input type="text" name="first" id="first"></td>
</tr>
<tr>
<td> Last Name: </td>
<td> <input type="text" name="last" id="last"></td>
</tr>
<tr>
<td> Password: </td>
<td> <input type="password" name="password" id="password">
</td>
</tr>
83
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Forms - The Input Element
Form Using Radio Buttons and Check Boxes - Code Part 2
<tr>
<td> Gender: </td>
<td>
<input type="radio" value="male" name="gender"> Male
<input type="radio" value ="female" name="gender"> Female
</td>
</tr>
<tr>
<td valign="top"> Age Range: </td>
<td> <input type ="radio" value="0" name="age"> Under 18 </br>
<input type ="radio" value="1" name="age"> 19 - 39 </br>
<input type ="radio" value="2" name="age"> 40-59 </br>
<input type ="radio" value="3" name="age"> Over 60 </br>
</td>
</tr>
<tr>
84
Copyright: LCCT International Education Institute :: Anjan Mahanta ::
HTML Forms - The Input Element
Form Using Radio Buttons and Check Boxes - Code Part 3
<tr>
<td valign="top"> Places you like: </td>
<td>
<input type="checkbox" value="bangkok" name="places"> Bangkok </br>
<input type="checkbox" value="chiangmai" name="places"> Chiangmai
</br>
<input type="checkbox" value="phuket" name="places"> Phuket </br>
<input type="checkbox" value="pattaya" name="places"> Pattaya </br>
</td>
</tr>
<tr>
<td> <input type= "reset" value="Clear"> </td>
<td> <input type ="submit" value="Send"> </td>
</tr>
</table>
</form>
</body>
</html> 85
Copyright: LCCT International Education Institute :: Anjan Mahanta ::