Chapter Two HTML
Chapter Two HTML
HTML
Dawed O.
HTML (Hyper Text Markup Language)
●
is a markup language (markup -instructions for layout and style)
– is used to tell a Web browser
●
where the heading is for a Web page,
●
what is a paragraph,
●
what is part of a table and so on, so it can structure your
document and render it properly.
●
is not programing
Syntax:
<element name> Content here </element name>
The structure of an HTML element
</element name>
3
The structure of an HTML element
4
Simple page
<html>
<head>
<title> GuZo Ethiopia Travel and Tour PLC : About us
</title>
</head>
<body>
<h1>About Guzo Ethiopia Travel and Tour PLC</h1>
<p>GuZo Ethiopia Travel and Tour PLC have been serving
in Ethiopia for the last three decades with honesty, great
hospitality and professional ethics. <p>
</body>
</html>
Simple page
Looking at the code
<html>
<head>
Looking at the code
</body>
</html>
Looking at the code
Looking at the code
<html>
<head>
</html>
Tags
● <html> . . . </html>
● contains the whole page
● <head> . . . </head>
● the head of the page
● contains information about the page which is not displayed
– Title
– Description of the page
– Keywords that search engines can use to index the page
(Meta )
Cont'd . . . Tags
● <body> . . . </body>
●
the body of the page, main content
●
the information seen in the main browser window
Adding style
●
Adding styles include:
– Adding font types
– Making fonts Blod , italic or underline
– Colors
– Alignment
– Change background color or picture
– etc
●
for the last three decades with honesty, great hospitality and professional
ethics.<p>
</font>
</body>
</html>
Elements and their Attributes
●
<font> - element
●
face – attribute
●
color – attribute
●
Attributes say something about elements.
●
Attributes have two parts
– Name – the property to be set eg. face, color
– Value – is the value of the property eg. Arial, 71ec90
●
XHTML documents are contained between the opening <html> and
closing </html> called root element
●
Inside the root element the document is divided in to two
– The <head> element, which contains information about the
document
●
such as a title or a link to a style sheet
– The <body> element, which contains the real content of the
document that you see.
The <html> Element
●
It comes after optional XML declaration and required DOCTYPE
declaration
●
If you are writing Strict XHTML 1.0,the opening tag must also
include something known as a namespace identifier (this indicates
that the markup in the document belongs to the XHTML 1.0
namespace).
<html xmlns="http://www.w3.org/1999/xhtml">
The <head> Element
The <head> Element can contain one of the following in any order
●
<title> - to display the title of the page
●
<object>, which is designed to include images, JavaScript objects,
Flash animations, MP3 files,QuickTime movies and other
components of a page.
●
<link> to link to an external file, such as a style sheet or
JavaScript file
●
<style> to include CSS rules inside the document
●
<script> for including script in the document
●
<meta>, which includes information about the document such as
keywords and a description,which are particularly helpful for
search applications;
The <title> Element
●
a title is needed for every page that you write inside the <title>
element
●
The title of a web page is used for
– At the very top of a browser window
– As the default name for a bookmark
– By search engines that use its content to help index pages
●
So it is important to write the title of the page which can
describe it well.
– Eg. “Guzo Ethiopia Travel and Tour : Contact us” describes the
page more than just “Contact us”
Basic text formatting
●
Whitespace and Flow
– several consecutive spaces between two words
– a new line in your source document
– consecutive empty lines,
– Tab characters
</html>
Cont'd . . . Example
Creating Headings using Hn Element
●
In XHTML you have six levels of headings, which use the elements
<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>. Example:
<html>
<body>
<h1> Heading 1 </h1>
<p> The content under heading one goes here. </p>
<h2> Heading 2 </h2>
<p> The content under heading two goes here. </p>
<h3> Heading 3 </h3>
<p> the content under heading three goes here. </p>
<h4> Heading 4 </h4>
<p> The content under heading four goes here. </p>
<h5> Heading 5 </h5>
<p> The content under heading five goes here. </p>
<h6> Heading 6 </h6>
<p> The content under heading six goes here. </p>
</body>
</html>
Example
Heading
●
The six heading elements can all carry the universal attributes as
well as a deprecated attribute called align.
– align, class, id, style, title, dir
● The align Attribute (deprecated)
– <h1 align="left">Left-Aligned Heading</h1>
...
Creating Line Breaks
●
Whenever you use the <br /> element, anything following it
starts on the next line.
<br /> (XHTML)
Creating Preformatted Text
●
It will display the content as it is formated in the source
document
● <pre> . . . </pre>
●
most browsers would display this text in a monospaced font by
default
– Used to display tabular data without the use of a table(in
which case you must use the monospaced font or columns will
not align correctly) and
– to represent computer source code.
<body>
<pre>
</p>
</body>
</html>
Example: using <pre> tag to display souce code
<html>
<body>
<p> Java code to add two integers
<pre>
sum = var1 + var2;
System.out.println("the sum is " + sum);
</pre>
</p>
</body>
</html>
Horizontal Rules
●
Is a divider between sections
●
Use <hr> html or <hr /> xhtml
●
eg.
<body>
<h3>Times</h3>
<p>Description and history of the Times typeface.</
p>
<hr />
<h3>Georgia</h3>
<p>Description and history of the Georgia
typeface.</p>
</body>
Address
●
the address element that is used to provide contact information
for the author or maintainer of the document.
<address>
Contributed by <a href="../authors/robbins/">Jennifer Robbins</a>,
<a href="http://www.oreilly.com/">O’Reilly Media</a>
</address>
Lists
●
You can create three types of lists in XHTML:
Defining terms
●
Used when defining instance of a word
<p><dfn>Script typefaces</dfn>
are based on handwriting.</p>
Program code elements
● are used for describing the parts of technical documents, such as:
– code (code),
– variables (var),
– program samples (samp), and
– user-entered keyboard strokes (kbd).
● Code, sample, and keyboard elements typically render in a
constant-width (also called monospace) font such as
Courier by default.
● Variables usually render in italics.
Inserted and deleted text
●
The ins and del elements are used to mark up changes to the text
and indicate parts of a document that have been inserted or
deleted
” " "
& & &
< < <
> > >
® ® ®
© © ©
eg. <p> " this is quoted text "</p>
<p>5>4</p>
Attributes
●
id
– used to uniquely identify any element within a page or style
sheet.
●
to link to a specific point in a document,
●
to select one specific element’s content,
●
to associate a CSS style with a particular element,
●
or identify that element using a script
– If you have two elements of the same name within a Web page
<body>
Go to the <a href="index.html">index page </a>
</body>
● The file index.html should be in the same folder
Linking to a website
●
to link to a different site you need to write the URL between the
<a> and </a> tags - source anchor,
<body>
You can also <a href="http://www.google.com/">search Google</a>?
</body>
●
You can include title attribute to links – when the mouse is over
the link additional information could be delivered to the user.
<body>
<a href="http://www.Google.com/" title="Search the Web
with Google">Google</a>
is a very popular search engine.
</body>
Using an image as a link
●
put the img element in the anchor element:
<a href="http://www.oreilly.com"><img src="ora.gif" /></a>
●
Most browsers display linked text as blue and underlined, and
linked images with a blue border.
●
Visited links generally display in purple.
●
One can change the color of links by using CSS and it is
recommended that you keep them consistent throughout your site
so as not to confuse your users.
Absolute and Relative URLs
●
No two files on the Internet share the same URL
●
An absolute URL uniquely identify a particular file on the
Internet.
http://www.exampleNewsSite.com/Entertainment/Film/index.htm
●
A relative URL indicates where the resource is in relation to the
current page.
●
If you are at the index page for the entertainment section you
can link to film index page in the following way:
– Film/index.htm
●
the browser changes the relative URLs into full absolute URLs.
(Cont'd. . .) Absolute and Relative URLs
●
Another key of using relative URLs within your site is that it
means you can change your .domain name
Same Directory
●
When you want to link to or include a resource from the same
directory, you can just use the name of that file.
●
For example, to link from the home page (index.html) to the
contact us page (contactUs.htm),
– contactUs.htm
Linking Within Your Own Site
● Film,
● Arts, and
● Music.
Example
● Linking within a directory
– <a href="about.html">About the site...</a>
● Linking to a lower directory
– From root-directory(exampleNewSite.com) to index in Film directory
– <li><a href="Entertainment/Films/index.html">Visit Film's </a></li>
● Linking to a higher directory
– Use ../ to link one level up in the directory
– Use ../ ../ to link two level up in the directory and so on
– To link from Film directory to the Entertainment's index page
– <li><a href="../index.html">Visit Film's </a></li>
Linking to a specific part of a page
● If you have a long Web page, you might want to link to a specific part
of that page.
● The destination anchor allows the page author to mark specific points
in a page that a source link can point to.
<body>
<p>This page covers the following topics:
<ul>
<li><a href="#URL">URLs</a></li>
<li><a href="#SourceAnchors">Source Anchors</a></li>
<li><a href="#DestinationAnchors">Destination Anchors</a></li>
<li><a href="#Examples">Examples</a></li>
</ul>
</p>
<h1>Linking and Navigation</h1>
<h2><a name="URL">URLs</a></h2>
<h2><a name="SourceAnchors">Source Anchors</a></h2>
<h2><a name="DestinationAnchors">Destination Anchors</a></h2>
<h2><a name="Examples">Examples</a></h2>
</body>
Linking to a fragment in another
document
● Problem with putting links on your page is that when people click on
them, they may never come back.
● Solution to this Problem is to have the linked page open in a new
browser window Opens a fresh window
to display the link
● To open a new window using (X)HTML markup,
– use the target attribute in the anchor (a) element ,
– Set the value of target to _blank ( target="_blank" )
For example:
<a href="http://www.oreilly.com" target="_blank">O'Reilly</a>
Or to open one window and to use it repeatedly:
<a href="http://www.oreilly.com" target="display">O'Reilly</a>
Could be any name
Linking to E-mail Addresses
● To create a link to an e-mail address you need to use the following
syntax with the <a> element:
<a href="mailto:[email protected]">[email protected]</a>
<a href="mailto:[email protected]">E-mail us</a>.
(Cont'd. . .) Linking to E-mail Addresses
● You can also specify some other parts of the message, too, such as
the
– subject,
– body, and
– people that it should be cc’d or blind cc’d to.
<a href="mailto:[email protected]?subject=XHTML">
<a href="mailto:[email protected]?
subject=XHTML&[email protected]"></a>
Tables
●
Are used
– displaying tabular data
– to format whole pages and create visually attractive layouts
( recently CSS is becoming the standard for layout and tables
are not recommended )
●
We use <table> . . . </table>
(Cont'd . . .) Tables
●
to create a table in XHTML use the <table> element.
●
A row is contained inside a <tr> element— table row
●
each cell is then written inside the row element using a <td>
element for “table data” and <th> for “table headers,”
<table border="1">
<tr>
<td>row 1, column 1 </td>
<td>row 1, column 2 </td>
</tr>
<tr>
<td>row 2, column 1 </td>
<td>row 2, column 2 </td>
</tr>
Table Headers
●
the text marked up as headers (th elements) are displayed
differently from the other cells in the table (td elements).
– Bold and
– Centric
●
~ are important because they provide information or context
about the cells in the row or column
Exercise
In the code fragment below how many columns and rows are there?
<table>
<tr>
<td>Sufjan Stevens</td>
<td>Illinoise</td>
<td>Asthmatic Kitty Records</td>
</tr>
<tr>
<td>The Shins</td>
<td>Oh Inverted World</td>
<td>Sub-pop Records</td>
</tr>
</table>
Exercise -1
● write the markup for the table shown
Spanning Cells
●
is the stretching of a cell to cover several rows or columns
●
You make a header or data cell span by adding the colspan or
rowspan attributes
●
Column spans, created with the colspan attribute in the td or th
element, stretch a cell to the right to span over the subsequent
columns
– Example :
<table border="1">
<tr>
<th colspan="2">Fat</th>
</tr>
<tr>
<td>Saturated Fat (g)</td>
<td>Unsaturated Fat (g)</td>
</tr>
</table>
Exercise -2
– write the markup for the table shown
Row spans
●
Row spans, created with the rowspan attribute
– cause the cell to span downward over several rows.
– Example:
<table>
<tr>
<th rowspan="3">Serving Size</th>
<td>Small (8oz.)</td>
</tr>
<tr>
<td>Medium (16oz.)</td>
</tr>
<tr>
<td>Large (24oz.)</td>
</tr>
</table>
Exercise:
●
write the markup for the table shown
The align attribute (deprecated)
●
alignment of the table within the containing body-text flow
●
accepts a value of either left, right, or center,
<tr bgcolor="blue">
Cell Padding and Spacing
●
By default, cells are sized just large enough to fit their contents
●
Cell padding is the amount of space held between the contents of
the cell and the cell border.
●
if you don’t specify any cell padding, the cells will have the default
value of one pixel of padding.
With With out
– Example: cellpadding cellpadding
<table border="1" cellpadding="15">
<tr>
<td>CELL 1</td>
<td>CELL 2</td>
</tr>
<tr>
<td>CELL 3</td>
<td>CELL 4</td>
</tr>
</table>
Cont'd ... Cell Padding and Spacing
●
cellpadding attribute may be used with the table element only,
the cellpadding value applies to all the cells in the table.
●
Cell spacing is the amount of space held between cells, specified
in number of pixels.
<table border="1" cellpadding="15" cellspacing="15">
<tr>
<td>CELL 1</td>
<td>CELL 2</td>
</tr>
<tr>
<td>CELL 3</td>
<td>CELL 4</td>
</tr>
</table>
The width and height attributes
●
the width attribute is either
– an integer number of pixels
<table width=400>
– a relative percentage of the screen width
<table width="50%">
●
height attribute to suggest a recommended height for the table
The align and valign attributes in
<tr> tag
●
The align attribute for the <table> tag may be deprecated in the
HTML and XHTML but not in <tr> tags
●
align attributes could be left, right, center, and justify
●
the valign attribute in the <tr> tag with a value of top, bottom,
center, middle, or baseline (Internet Explorer only),
<img src="logo.gif" alt="Wrox logo" /> -- works fine if logo.gif and the file are
in the same folder.
● <image> carry the following attributes:
– src - is required to specify the URL of the image to load. src="url" the url
could be absolute or relative.
– alt - to specify a text alternative for the image in case the browser
cannot display. alt="Company logo"
– align - used to align the image within the page or the element that
contains the image(such as a table cell). Eg align="right" . The values
could be: top, middle, bottom, left, right
Cont'd ... Adding Images
– border - specifies the width of the border around the image in
pixels. Eg. border="2" , the default value is 0 unless it is a link.
– height and width - specify the height and width of the image:
Eg. height="120" width="180"
● The values can either be pixels or a percentage (%)of the
page or containing element.
● It is a good practice to specify the height and width of an
image, becouse it will allow the browser to render the rest of
the page before the image.
– hspace vspace - are used to control the amount of whitespace
around an image. Eg. Hspace="10" vspace="14"
●
helpful because text can flow around an image
Cont ... Adding Images
<body>
<img src="imageMap.jpg" width="300" height="300" alt="Image map test "
usemap="#color" />
<map name="color">
<area shape="rect" coords ="25,25,125,125" href="blueRectangle.html" alt="blue
rectangle" title="Blue rectangle" />
<area shape="circle" coords="150,150,25" href="circle.html" alt="circle" title="circle" />
<area shape="poly" coords="95,300,85,165,200,265,300,161,300,300" href="poly.html"
alt="green polygon" title="Green area"/>
</map>
</body>
Questions?
Frames
Frames
●
Frames divide a browser window into several pieces or panes, each
pane containing a separate XHTML page.
●
One of the key advantages that frames offer is that you can then
load and reload single panes without having to reload the entire
contents of the browser window.
●
A collection of frames in the browser window is known as a
frameset.
(Cont'd . . .) Frames
●
To create a frameset document,
– first you need the <frameset> element, which is used
instead of the <body> element.
– The frameset defines the rows and columns your page is
divided into, including where each individual frame will
go.
– Each frame is then represented by a <frame> element.
Example
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html>
<head>
<title>Frames example</title>
</head>
<frameset rows="150, *, 100">
<frame src="top_frame.html" />
<frame src="main_frame.html" />
<frame src="bottom_frame.html" />
<noframes><body>
This site uses a technology called frames. Unfortunately, your
browser does not support this technology. Please upgrade
your browser and visit us again!
</body></noframes>
</frameset>
</html>
The <frameset> Element
●
The <frameset> element replaces the <body> element in frameset
documents.
●
the attributes of the <frameset> element
– cols specifies how many columns are in the frameset
– rows specifies how many rows are in the frameset
– <frame> element for each frame of the document
– <noframes> elements to indicate what should be displayed
to the user if their browser does not load frames.
The cols Attribute
●
specifies
– how many columns are contained in the frameset and
– the size of each column.
– Eg cols="20%, 60%, 20%" – three columns and their relative
size
●
If you do not specify a cols attribute then the default value is
100 percent
●
You can specify the width of each column in one of four ways:
– Absolute values in pixels
– A percentage of the browser window (or parent frame if
you are nesting framesets)
– Using a wildcard symbol (*)
– As relative widths of the browser window (or parent
frame)
Width of column
●
A Percentage of the Browser Window or Parent Frame
– use a number followed by the percent sign
– Cols="40%, 60%"
●
The first frame takes 40% of the browser window
●
The second frame takes 60% of the browser window
●
The Wildcard Symbol (*)
– The asterisk, or wildcard symbol, indicates the “rest of
the window,”
– Cols="400, *"
– <frameset cols="10%,3*,*,*"> - ??
Width of column
●
Relative Widths Between Columns
– Cols="3*, 2*, 1*"
●
It is divided into six and the first frame takes half
of it
●
Absolute Values in Pixels
– use a number
– Cols="100, 500, *" - - three columns 100, 500 and the
rest
– Cols="100, 100, 100" – will produce three frames of size
100, but if the screen size is 600px it will produce
three 200 px size frames
– Cols= “100,100,100,*” will produce three exactly 100px
frames and one frame to fill the rest of the space
Additional <frameset> Element
●
The border Attribute
– specifies the width of the border of each frame in pixels.
– border="10"
Additional <frameset> Element
●
The frameborder Attribute
– Used to display a three-dimensional border between
frames.
– frameborder="0" - the border will not show
– frameborder="1" - to display border
●
The framespacing Attribute
– specifies the amount of space between frames in a
frameset
– should be given in pixels and the default value is 2
The <frame> Element
●
indicates what goes in each frame of the frameset.
●
The src Attribute
– indicates the file that should be used in the frame
– src="main_page.html"
●
The name Attribute
– it is used to indicate which frame a document should be
loaded into.
– to create links in one frame that load pages into a second
frame
– name="main_frame"
The <frame> Element
●
The marginwidth and marginheight Attributes
– Specifies the space between the three-dimensional
border of a frame and its contents.
– marginheight="10" marginwidth="10"
●
The noresize Attribute
– prevents a user from being able to resize the frame
– noresize="noresize"
The <frame> Element
●
The scrolling Attribute
– scrolling="yes" - to always have the scrollbar
– or “no” - the frameset will not contain a set of scrollbars
– or “auto” - browser should include scrollbars when the
content does not fit in the frame
●
The <noframes> Element
– If a user’s browser does not support frames the contents
of the <noframes> element should be displayed to the
user.
– place a <body> element inside the <noframes>
Creating Links Between Frames
The most popular uses of frames is to place navigation bars in one
frame and then load the pages with the content into a separate
frame. This is particularly helpful in three situations:
●
When your navigation bar is rather large in size (such as
thumbnails of photographs in a gallery).By using frames, the user
does not need to reload the navigation bar each time she views a
new page.
●
When your main document is very long and the navigation bar
provides shortcuts to parts of the main document.
●
When you do not want to reload the whole page.
Creating
– Links Between Frames
In frame_link.html
<frameset cols="200, *"
<frame src="frames/linksNav.html" />
<frame src="frames/linksMain.html" name="main_page" />
</frameset>
– In linksNav.html
<body>
<h1> Navigation </h1>
<a href="http://www.wrox.com" target="main_page">Wrox Press</a><br />
<a href="http://www.google.com" target="main_page">Google</a><br />
<a href="http://www.microsoft.com" target="main_page">Microsoft</a><br />
<a href="http://news.bbc.co.uk/" target="main_page">BBC News</a><br />
</body>
– In linksMain.html
<body>
<h3> The links should display here </h3>
</body>
target
●
The target attribute can also take the attribute values
<head>
</head>
Inline Frames
●
define a frame that exists within a conventional document,
displayed as part of that document's text flow.
Contains: plain_text
Example:
<li><label for="form-city">City:</label>
<input type="text" name="city" value="Your Hometown" size="25"
maxlength="50" id="form-city" /></li>
The value attribute specifies default text that appears in the field
when the form is loaded. When you reset a form, it returns to
this value.
Cont'd . . . Single-line text field
Size
●
By default, browsers display a text-entry box that is 20
characters wide, but you can change the number of characters
using the size attribute. eg. size="25"
maxlength
●
By default, users can type an unlimited number of characters in a
text field regardless of its size.
●
You can set a maximum character limit using the maxlength
attribute. Eg maxlength="50"
Password text entry field
●
A password field works just like a text entry field, except the
characters are obscured from view using asterisk (*) or bullet (•)
characters,
Example:
<li><label for="form-pswd">Log in:</label> <input type="password"
name="pswd" size="8" maxlength="8" id="form-pswd" /></li>
Multiline text entry field
●
Syntax: <textarea>...</textarea>
●
Example:
<li><label for="form-entry">Official contest entry:</label>
<br/><textarea name="contest_entry" rows="5" cols="100"
id="form-entry">Tell us why you love the band in 50 words or
less. Five winners will get backstage passes!</textarea></li>
rows
●
Specifies the number of lines of text the area should display.
Scrollbars will be provided if the user types more text than fits in
the allotted space.
cols
●
Specifies the width of the text area measured in number of
characters
Submit and reset buttons
●
submit button immediately sends the collected form data to the
server for processing.
●
reset button returns the form controls to the state they were in
when the form loaded.
●
submit and reset buttons are added using the input element.
<input type="submit" />
<input type="reset" />
eg. <p><input type="submit" /> <input type="reset" value="Start
over" /></p>
Radio and checkbox buttons
●
radio buttons is appropriate when only one option from the group
is permitted
Example:
<fieldset>
<legend>How old are you?</legend>
<ol>
<li><label><input type="radio" name="age" value="under24"
checked="checked" /> under 24</label></li>
<li><label><input type="radio" name="age" value="25-34" /> 25 to
34 </label></li>
<li><label><input type="radio" name="age" value="35-44" /> 35 to
44 </label></li>
<li><label><input type="radio" name="age" value="over45" /> 45+
</label></li>
</ol>
</fieldset>
Cont'd . . . Radio and checkbox buttons
●
Checkboxes allow users to select as many or
<select>...</select>
An option within a menu
<option>...</option>
A logical grouping of options within a menu
<optgroup>...</optgroup>
Pull-down menus
●
only one item may be selected.
●
select element displays as a pull-down menu by default when
– no size is specified or
– if the size attribute is set to 1
Example:
<label for="form-fave">What is your favorite 80s band?<label><br /
>
<select name="EightiesFave" id="form-fave">
<option>The Cure</option>
<option>Cocteau Twins</option>
<option>Tears for Fears</option>
<option>Thompson Twins</option>
<option value="EBTG">Everything But the Girl</option>
</select>
●
Use the value attribute to provide an overriding value.
Scrolling menu
●
specify the number of lines you’d like to be visible using the size
attribute.
●
The multiple attribute allows users to make more than one selection
from the scrolling list.
<label for="EightiesBands">What 80s bands did you listen to?
</label>
<select name="EightiesBands" size="6" multiple="multiple"
for="EightiesBands">
<option>The Cure</option>
<option>Cocteau Twins</option>
<option selected="selected">Tears for Fears</option>
<option selected="selected">Thompson Twins</option>
<option value="EBTG">Everything But the Girl</option>
<option>Depeche Mode</option>
<option>The Smiths</option>
<option>New Order</option>
</select>
Grouping menu options
●
You can use the optgroup element to create conceptual groups of
options.
●
Example :
<select name="icecream" multiple="multiple">
<optgroup label="traditional">
<option>vanilla</option>
<option>chocolate</option>
</optgroup>
<optgroup label="fancy">
<option>Super praline</option>
<option>Nut surprise</option>
<option>Candy corn</option>
</optgroup>
</select>
File selection control
●
Forms can be used to transmit external documents from a user’s
hard drive.
●
~ is used to select a document from the hard drive to be
submitted with the form data.
●
Syntax: <input type="file" />
●
Eg: