HTML Tutorial
HTML Tutorial
HTML Tutorial
There are lots of HTML tags and Attributes. In this tutorial I have mentioned some tags
and attributes which are easier and helpful for a web developer.
If you found any mistakes in this tutorial feel free to comment and don’t be so selfish Please send me your
Problems I will try my best to reply you as soon as possible (if you send me message on my Facebook.
You can Catch me on Facebook, follow me on Twitter and Watch my Videos on YouTube.
Pradip Adhikari;CoderPradip 1
HTML is a computer language devised to allow website creation. These websites can then be viewed
by anyone else connected to the Internet. It is relatively easy to learn, with the basics being
accessible to most people in one sitting; and quite powerful in what it allows you to create. It is
constantly undergoing revision and evolution to meet the demands and requirements of the growing
Internet audience under the direction of the W3C, the organisation charged with designing and
maintaining the language.
Pradip Adhikari;CoderPradip 2
<head>
<title>Title of the document</title>
</head>
<body>
The content of the document......
</body>
</html>
After writing the code you must save the file as name.html for example:
index.html(the format must be html or htm).
The <!DOCTYPE> declaration must be the very first thing in your HTML document,
before the <html> tag.
Pradip Adhikari;CoderPradip 3
<html> tells the browser that this is an html file.
The <head> element can include a title for the document, scripts, styles, meta
information, and more.
<title>
<style>
<script>
<meta>
<Link> etc.
Example:
<body bgcolor=”red”>
</body>
Pradip Adhikari;CoderPradip 4
Heading Tag
It has 6 heading <h1> to <h6>. The heading tag defines the heading of the document.
Example
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Pradip Adhikari;CoderPradip 5
Paragraph Tag
<p> tag defines a Paragraph
For example
<p>This is paragraph</p>
Pradip Adhikari;CoderPradip 6
Line Break Tag
<br> tag breaks a line. <br> is a single tag so we don’t have to write a closing tag.
Example:
Pradip Adhikari;CoderPradip 7
Center Tag
<center> tag is used to center-align.
Example:
<center>
</center>
Pradip Adhikari;CoderPradip 8
Link Tag
<a> tag is used to link from one page to another.
1. Internal hyperlink
For example:
2. External hyperlink
Pradip Adhikari;CoderPradip 9
Attributes name Values Description
href Link/path of url Specifies the link.
target _blank/_top/_self/_parent Specifies where to open linked
file.
download filename Allows the user to download file
when clicked.
Title Your text Specifies the title on mouse
hover.
Example:
Image Tag
<img> tag defines a image in HTML page. <img> tag is an Single/empty tag so it doesn’t have
any closing tag.
Pradip Adhikari;CoderPradip 10
Attributes name Values Description
Src Link or path of image Specifies the url or path of an
image.
Alt Your text Defines a alternative text for an
image.
align Left/right/top/bottom/middle Specifies the alignment of an
image.
Border Value in pixel Specifies the border around the
image.
Height/width Value in pixel Specifies height & width of
image.
Title Your text Specifies the title of an image.
Example:
Pradip Adhikari;CoderPradip 11
Font tag
The <font> tag specifies the font face, font size, and color of text.
Example:
List tag
Pradip Adhikari;CoderPradip 12
Attributes name Values Description
Type 1/a/I (order list) Specifies the type of list.
Circle/square/disc(unorder
list)
Start B/6/V (order list) Specifies from where to start
the list.
I. Order List
The <ol> tag defines an ordered list. An ordered list can be numerical or alphabetical.
Example:
<li>Programmer</li>
<li>Hacker</li>
</ol>
Pradip Adhikari;CoderPradip 13
II. Unorder List
<ul type="circle">
<li>Hacker</li>
<li>Programmer</li>
</ul>
Pradip Adhikari;CoderPradip 14
III. Definition List
Example:
<dl>
<dt>Hacker</dt>
<dd>Hacker Hacks other's sites or accounts</dd>
<dt>Programmer</dt>
<dd>Programmer writes codes and designs</dd>
</d
Pradip Adhikari;CoderPradip 15
Table Tag
<table> tag defines table in HTML.
Pradip Adhikari;CoderPradip 16
Example:
<tr>
<th>Hacker</th>
<th>Programmer</th>
</tr>
<tr>
<td>Hacks</td>
<td>Codes</td>
</tr>
</table>
Pradip Adhikari;CoderPradip 17
Table Rowspan/Colspan
The Rowspan specifies the number of rows a header cell should span.
The Colspan specifies the number of columns a header cell should span.
Example:
<tr>
<th rowspan="2">Name</th>
<th colspan="3">Marks</th>
Pradip Adhikari;CoderPradip 18
</tr>
<tr>
<th>FM</th>
<th>PM</th>
<th>OM</th>
</tr>
<td>CoderPradip</td>
<td>100</td>
<td>32</td>
<td>50</td>
</tr>
</table>
Pradip Adhikari;CoderPradip 19
Iframe Tag
<iframe> specifies an inline frame.
Example:
Pradip Adhikari;CoderPradip 20
Video and Audio Tag
Attributes name Values Description
Controls No-value or Controls Specifies the control box.
Autoplay No-value or autoplay It plays the video/audio when
page is loaded.
loop Times(1,2,3) or inifinite Specifies how many time the
video/audio should be played.
Muted No-value or muted Specifies that the video/audio
is muted.
Height/width value Specifies the height/width of
the video/audio.
Poster Path/url of the image Specifies an image to be
(Only for Video) shown while the video is
downloading, or until the
user hits the play button
Pradip Adhikari;CoderPradip 21
elements, such as <video> and <audio>.
Attributes of <Source>
Video Tag
Example:
</video>
Pradip Adhikari;CoderPradip 22
Audio Tag
Example:
</audio>
Pradip Adhikari;CoderPradip 23
Embed Tag
The <embed> tag is used to include some other files in html (like PDf files).
Example:
Pradip Adhikari;CoderPradip 24
Marquee Tag
<marquee> tag is specifies scrolling text or document.
Example:
Pradip Adhikari;CoderPradip 25
Programmer</marquee>
HTML Form
Input Tag
<input> specifies an input field where user can enter data.
Pradip Adhikari;CoderPradip 26
Attributes name Values description
type Text Specifies the type <input>
Password element to display.
Email
Radio
checkbox
Button
submit
File
Hidden
Range
url
color
date
datetime-local
search
etc..
Example:
Pradip Adhikari;CoderPradip 27
<input type="text" placeholder="Name" required> <br>
<input type="file"><br>
Select Tag
<select> element is used to create a drop down list.
Pradip Adhikari;CoderPradip 28
Multiple Multiple/no value Specifies that multiple option
can be selected.
Required Required/no value Must be filled out.
Disable Disable/no value Specifies that the drop down is
disabled.
Autofocus Autofocus/no value Specifies that the drop down
list should be focused
automatically.
Name name Defines a name.
Option Tag
There is <option> tag that is used with the <select> tag.
Example:
<select>
<option value="hacker">Hacker</option>
<option value="programmer">Programmer</option>
</select>
Pradip Adhikari;CoderPradip 29
Text Formatting Tag
<b>bold</b>
<i>Italic</i>
<u>Underlined</u>
<strike> Strike</strike> or <s>Strike</s> or <del> Delete</del>
<small> Small</small>
<q>Quotation</q>
<big>Big</big>
This is <sub>Subscript</sub>
This is <sup>SuperScript</sup>
<code>code</code>
<pre>Preformatted</pre>
<var> Var</var>
Pradip Adhikari;CoderPradip 30
Example of a Form(with no style from CSS)
<!DOCTYPE html>
<html>
<head>
<title>CoderPradip</title>
</head>
Pradip Adhikari;CoderPradip 31
<body bgcolor="grey">
<h1>Sign up Form</h1>
<hr>
<form>
<fieldset>
<label> First Name : </label> <input type="Text" placeholder="example: Coder" required>
<label> Last Name : </label> <input type="Text" placeholder="example: Pradip" required> <br>
<label>Gender : </label>
<label>Skills : </label>
<select required>
<option>Nepal</option>
<option disabled>India</option>
<option>China</option>
<option>Pakistan</option>
</select> <br>
Pradip Adhikari;CoderPradip 32
<label>Photo : </label> <input type="file"> <br>
</fieldset>
</form>
</center>
</body>
</html>
Pradip Adhikari;CoderPradip 33
Looking for Complete Programming Tutorial?
Also want to learn CSS, JAVA SCRIPT AND PHP ?
I will be uploading tutorials on my Blog, Facebook, Twitter
and YouTube.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Pradip Adhikari;CoderPradip 34
www.facebook.com/coderpradip
www.twitter.com/coderpradip
Search CoderPradip in Social Networking sites.
Pradip Adhikari;CoderPradip 35