Professional Documents
Culture Documents
What is HTML?
Hypertext means that the document contains links that allow the reader to jump
to other places in the document or to another document altogether.
Hypertext is a way to link two or more web pages (HTML documents) with
each other.
Markup Language means we use HTML to simply "mark-up" a text document with
tags that tell a Web browser how to structure it to display.
First Program
<!DOCTYPE html>
<html>
<head>
<title>This is document title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>Document content goes here.....</p>
</body>
</html>
<html > : This tag informs the browser that it is an HTML document. Text between
html tag describes the web document. It is a container for all other elements of
HTML except <!DOCTYPE>
<head>: It should be the first element inside the <html> element, which contains
the metadata(information about the document). It must be closed before the
body tag opens.
<title>: As its name suggested, it is used to add title of that HTML page which
appears at the top of the browser window. It must be placed inside the head tag
and should close immediately. (Optional)
<body> : Text between body tag describes the body content of the page that is
visible to the end user. This tag contains the main content of the HTML document.
<h1> : Text between <h1> tag describes the first level heading of the webpage.
<p> : Text between <p> tag describes the paragraph of the webpage.
Features of HTML
Building Blocks
Tags: Tags are used to mark up the start of an HTML element and they are usually
enclosed in angle brackets. An example of a tag is: <h1>.
In this instance, the image source (src) and the alt text (alt) are attributes of
the <img > tag.
Programs
Headings
<!DOCTYPE html>
<html>
<head>
<title> Web Page for Headings </title>
</head>
<body>
<h1 align="center">Heading-1</h1>
<h2>See the GNU General Public License for more details.</h2>
<h3>See the GNU General Public License for more details.</h3>
<h4>See the GNU General Public License for more details.</h4>
<h5>See the GNU General Public License for more details.</h5>
<h6>See the GNU General Public License for more details.</h6>
</body>
</html>
Paragraphs
<html>
<head>
<title>
web page for paragraph.
</title>
</head>
<body>
<pre>
<p align="right">
<!--left,right,justify need to tell about pre tag-->
This program is free software;you<sup> can </sup>redistributeit
and/or modify it RANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
</br>FOR A PARTICULAR
PURPOSE. See the GNU General <sub>Public</sub> License for more
details.
Marquee tag
<!DOCTYPE html>
<html>
<head>
<title> Web Page for Marquee Tag </title>
</head>
<body>
<marquee direction="left" behavior="slide" bgcolor="blue">V Sem Results
out</marquee>
<marquee direction="right" behavior="alternate" bgcolor="pink">VI Sem
Results out</marquee>
<marquee direction="right" behavior="scroll" bgcolor="red">VII Sem
Results out</marquee>
<!-- direcion=left,right,up,down behaviour=scroll,slide,alternate
width&hieght=pixels bgcolor=color name-->
</body>
</html>
Link tag
<!DOCTYPE html>
<html>
<head>
<title> Web Page for Link Tag </title>
</head>
<body bgcolor="pink">
<p>Hello welcome to Hyperlink</p>
<p>This paragraph will not be affected.</p>
<a href="https://www.facebook.com">Login to Facebook</a>
</body>
</html>
Image tag
<html>
<head>
<title> web page for image </title>
</head>
<body>
<img src="E:\IMAGES\Wall papers\baby.jpg" height="200px" width="200px"
align="left"
alt="Baby Image here" border="5">
<!--align=left,right,bottom,top,middle-->
</body>
</html>
HTML List
HTML lists are used to present list of information in well-formed and semantic
way. There are three different types of list in HTML and each one has a specific
purpose and meaning.
1. Unordered list — used to create a list of related items, in no particular
order.
2. Ordered list — used to create a list of related items, in a specific order.
3. Definition list — used to create a list of terms and their descriptions.
Note: We can create a list inside another list, which will be termed as nested List.
It is also called as bullet list. It is used to give bullets to the list items. The list items
in unordered lists are marked with bullets.
Example:
o Aries
o Bingo
o Leo
o Oracle
Syntax:
An unordered list created using the <ul> element, and each list item starts with
the <li> element. Both are paired tags.
<ul>
<li>……………</li>
<li>……………</li>
<li>……………</li>
<li>……………</li>
</ul>
Program:
<!DOCTYPE html>
<html>
<head>
<title>HTML Unordered List</title>
</head>
<body>
<ul type = "circle">
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ul>
</body>
</html>
Output:
o Beetroot
o Ginger
o Potato
o Radish
It is also called as numbered list. It is used to give numbering to the list items.
Ordered lists are used when the order of the list's items is important.
The list items in an ordered list are marked with numbers.
Example:
1. Beetroot
2. Ginger
3. Potato
4. Radish
Syntax
An ordered list created using the <ol> element, and each list item starts with
the <li> element. Both are paired tags.
<ol>
<li>…………………..</li>
<li>…………………..</li>
<li>…………………..</li>
</ol>
Program:
<!DOCTYPE html>
<html>
<head>
<title>HTML Ordered List</title>
</head>
<body>
<ol>
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ol>
</body>
</html>
Output:
1. Beetroot
2. Ginger
3. Potato
4. Radish
Syntax:
The description list is created using <dl> element. The <dl> element is used in
conjunction with the <dt> element which specify a term, and the <dd> element
which specify the term's definition.
<dl>
<dt>……</dt>
<dd>………..</dd>
<dt>……</dt>
<dd>………..</dd>
</dl>
Program:
<!DOCTYPE html>
<html>
<head>
<title>HTML Definition List</title>
</head>
<body>
<dl>
<dt>HTML</dt>
<dd>This stands for Hyper Text Markup Language</dd>
<dt>HTTP</dt>
<dd>This stands for Hyper Text Transfer Protocol</dd>
</dl>
</body>
</html>
Output:
HTML
This stands for Hyper Text Markup Language
HTTP
This stands for Hyper Text Transfer Protocol
Nested List:
CSE Subjects
1. Computer Neworks
2. Programming subjects
o C
o Java
o C++
o Python
3. FLAT
Program:
<!DOCTYPE html>
<html>
<body>
<h2>CSE Subjects</h2>
<ol>
<li>Computer Neworks</li>
<li>Programming subjects
<ul>
<li>C</li>
<li>Java</li>
<li>C++</li>
<li>Python</li>
</ul>
</li>
<li>FLAT</li>
</ol>
</body>
</html>
Output:
CSE Subjects
1. Computer Neworks
2. Programming subjects
o C
o Java
o C++
o Python
4. FLAT
Tables in HTML
HTML table allows you to arrange data into rows and columns. They are
commonly used to display tabular data like product listings, customer's details,
financial reports, and so on.
You can create a table using the <table> element. Inside the <table> element, you
can use the <tr> elements to create rows, and to create columns inside a row you
can use the <td> elements.
You can also define a cell as a header for a group of table cells using
the <th> element.
The following example demonstrates the most basic structure of a table.
Id Name Branch
501 Ram CSE
502 Raghu CSE
Tags:
<table> ----paired tag
<tr>----paired tag
<td>----paired tag
<th>----paired tag
Syntax:
<table>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
</table>
Attributes
border
bgcolor
cellspacing
cellpadding
align
rowspan
colspan
valign
align
Program:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Creating Tables in HTML</title>
</head>
<body>
<h2>HTML Table (Default Style)</h2>
<table>
<tr>
<th>No.</th>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>1</td>
<td>Peter Parker</td>
<td>16</td>
</tr>
<tr>
<td>2</td>
<td>Clark Kent</td>
<td>34</td>
</tr>
<tr>
<td>3</td>
<td>Harry Potter</td>
<td>11</td>
</tr>
</table>
</body>
</html
Q: Create the following timetable.
Time Table
Forms in HTML
Program:
<html>
<head>
<title>Forms in HTML</title>
</head>
<body>
<form action="welcome.html" method="get">
<fieldset style="width:500px;">
<legend>Personal Details</legend>
<label>Enter your Name</label><input type="text" size="30" name="username"
placeholder="Enter user name"/></br></br>
Enter your Password<input type="password" size="30" name="pwd"
placeholder="Enter password"/></br></br>
Enter your mail<input type="mail" size="30" name="mailid" placeholder="Enter
mail"/></br></br>
<label>Enter your mobile number</label><input type="number" size="30"
name="phnno" placeholder="Enter phn number"/></br></br>
<label>Enter your gender</label><input type="radio" name="gender"/>Male
<input type="radio" name="gender"/>Female
<input type="radio" name="gender"/>Others</br></br>
<label>Enter your DOB</label><input type="date" name="dob"/></br></br>
<label>Enter your Address</label></br>
<textarea rows="5" cols="50"></textarea></br></br>
<label>Enter your City</label>
<select>
<option>VZM</option>
<option>VIZAG</option>
<option>SKLM</option>
</select></br></br>
<label>Enter your subject</label><input type="checkbox" name="Subjects"/>C
<input type="checkbox" name="Subjects"/>JAVA
<input type="checkbox" name="Subjects"/>WT</br></br>
<label>Upload file</label><input type="file"/></br></br>
<input type="submit" value="Register"/>
<input type="reset" value="Clear"/></br></br>
<input type="button" value="OK"/>
</fieldset>
</form>
</body>
</html>
Frames in HTML