Professional Documents
Culture Documents
HTML Tags, Attributes, Text Formatting Tags, Meta Tag, Lists, Image, Links, Table, Frames,
Iframes, Forms etc.
Introduction
HTML stands for Hyper Text Markup Language.
It is used to create web pages.
HTML consists of several markup tags.
HTML tags are most commonly used in pairs like <html> and </html>.
Each HTML tag describes different document content.
Advantages
HTML is platform independent.
It is freely available for use.
It is case-insensitive.
HTML is very easy to learn and use.
It has features like tables and applets.
Disadvantages
Dynamic web pages cannot be created using HTML.
HTML does not have good security features.
HTML does not pass information to web pages.
Most of the browsers may not support all the tags of HTML
HTML Tags
Tags are enclosed in angular brackets i.e. '<' and '>'.
An HTML code begins with the tag <HTML> and finishes with </HTML>. All other tags are
used between two tags.
First tag in a pair is the start tag, and the second tag is end tag.
A complete tag is called as an element.
A tag has three major parts: opening tag, content and closing tag.
Syntax: <tagname>content</tagname>
Every HTML document starts with <html> tag and ends with </html> tag.
This <html> tag tells the browser where the document starts and </html> tag tells where the
document ends.
The HTML document is divided into two parts i.e. head and body.
Following figure shows the basic structure of HTML document.
<html> : Every html file starts with <html> tag. This tag tells the browser that content of the file
is in html format.
Syntax: <html>.........</html>
<head> : The <head> tag is used to indicate header area of the document.
Syntax: <head>.........</head>
<title> : The <title> tag is used to display text on the title bar of the browser.
Syntax: <title>.........</title>
<body> : The <body> tag contains actual content of the web page.
Syntax: <body>.........</body>
Comment tag: This tag is used to place the comments on the web page. Comments are not
executed.
Syntax: <comment>.......</comment>
All the browsers do not support comment tag. So, instead of a comment tag the delimiter tag is
used.
Syntax: <!-- place comment here -->
Output:
2. Paragraph Tag
Output:
This is the first paragraph.........
This is the second paragraph........
This is the third paragraph........
3. Break Tag
Output:
This tag is used to insert a line break.
It is empty tag.
4. Center Tag
Center tag is used to place the content in the center of a web page.
Syntax: <center>content</center>
Example: Center Tag
<!DOCTYPE html>
<html>
<head>
<title>Example of Center Tag</title>
</head>
<body>
<center>
<p>This is a paragraph.</p>
</center>
</body>
</html>
Output:
Output:
Text Formating Tags
The formatting tags indicate how text can appear in HTML.
These tags can make text bold, italic, underlined, superscripted, subscripted and more.
HTML text formatting tags are:
Tag Description
<abbr> Defines an abbreviation
<acronym> Defines an acronym
<address> Defines contact information for the author/owner of a document
<bdo> Defines the text direction
<blockquote> Defines a long quotation
<q> Defines a short quotation
<cite> Defines a citation
<dfn> Defines a definition term
Tag Description
name Defines a name of the metadata
Content Specifies the value associated with the http-equiv or name attribute
Scheme Specifies the scheme to be used to interpret the property's value
Http-equiv Specifies an HTTP header for the information/value of the content attribute
Example:
<meta name="author" content="Dennis Ritchie">
HTML Lists
Lists are used to represent group of items.
They must contain one or more list elements.
HTML supports three types of lists – Ordered list, Unordered list and Definition list.
1. Ordered list
Ordered list is the collection of related items which has special order or sequence. This list is
numbered.
The ordered list is created by using <ol> tag.
Syntax:
<ol>text</ol>
Example: Ordered list
<!DOCTYPE html>
<html>
<head>
<title>Example of HTML Ordered List</title>
</head>
<body>
<ol>
<li>Maths</li>
<li>Physics</li>
<li>Computer Science</li>
<li>Language</li>
</ol>
</body>
</html>
Output:
1. 1. Maths
2. 2. Physics
3. 3. Computer Science
4. 4. Language
Attributes of <ol> tag
Output:
a. Maths
b. Physics
c. Language
Output:
iv. Maths
v. Physics
vi. Language
Output:
c. Maths
5. Physics
2. Unordered list:
Unordered list is nothing but the collection of related items which has no special order or
sequence.
The list item in the list is indicated by bullet.
Syntax:
<ul>text</ul>
Example: Unordered list
<!DOCTYPE html>
<html>
<head>
<title>Example of HTML Ordered List</title>
</head>
<body>
<ul>
<li>Maths</li>
<li>Physics</li>
<li>Computer Science</li>
<li>Language</li>
</ul>
</body>
</html>
Output:
Maths
Physics
Computer Science
Language
Attributes of <ul>
type Used to specify type of list item like bullet, circle and square. Example:
Default type is bullet. <ul type="square">
<li>Maths</li>
<li>Physics</li>
<li>Language</li>
</ul>
Output:
3. Definition list:
Definition list has two parts, first is definition term and second is actual definition.
The <dl> tag is used to create definition list.
The <dl> tag encloses <dt> and <dd> tags which are used for definition term and actual
definition respectively.
Syntax:
<dl>
<dt>Definition Term</dt>
<dd>Definition</dd>
</dl>
Example: Definition list
<!DOCTYPE html>
<html>
<head>
<title>Example of HTML Definition List</title>
</head>
<body>
<dl>
<dt><b>jQuery</b></dt>
<dd>jQuery is a JavaScript Library.</dd>
<dt><b>AngularJS</b></dt>
<dd>AngularJS is a JavaScript framework.</dd>
</dl>
</body>
</html>
Output:
jQuery
jQuery is a JavaScript Library.
AngularJS
AngularJS is a JavaScript framework.
HTML Image
Example:
<img src="http://www.careerride.com/images/new/logo.png" width="200" height="100"
alt="CareerRide Info" align="left">
Attributes Description
vspace Specifies the amount of space to the top and bottom of the image.
hspace Specifies the amount of space to the left and right of the image.
alt Specifies alternate text for an image when image is not found.
Example: Hyperlink
<!DOCTYPE html>
<html>
<head>
<title>HTML links Example</title>
</head>
<body>
<p>Click following link</p>
<a href="http://www.tutorialride.com/">Visit TutorialRide.com</a>
</body>
</html>
Output:
Click following link
Visit TutorialRide.com
The target attribute is used to specify the location where linked document is opened.
Every target name starts with underscore (_).
HTML provides 4 basic target options.
Option Description
_top Opens the linked document in new window breaking all the frames.
_parent Opens the linked document in the parent frame of the current document.
Output:
HTML table
Table is nothing but a two dimensional matrix with a combination of rows and columns.
The <table> tag is used to define a table.
Table rows are created by using <tr> tag.
Table tows are divided into table data by using <td> tag.
The <th> tag is used to create table column heading or row heading.
Table border
Background color
Table Heading
Table heading is the title given to the table row or column or both.
The <th> tag is used to create table column heading or row heading.
Example: Table Heading
<!DOCTYPE html>
<html>
<head>
<title>HTML Table Header Example</title>
</head>
<body>
<table border="1">
<tr>
<th>Subject</th>
<th>Total marks</th>
</tr>
<tr>
<td>Math</td>
<td>100</td>
</tr>
<tr>
<td>Science</td>
<td>100</td>
</tr>
</table>
</body>
</html>
Output:
Rowspan and Colspan Attribute
rowspan: This attribute is used to combine two or more rows into a single cell.
colspan: This attribute is used to combine two or more columns into a single cell.
Table Caption
HTML frames
Frames are the sections created on the window.
Each section can load a separate HTML document.
The window is divided into frames in a similar way the tables are organized into rows and
columns.
Frames provide the facility to display multiple HTML document inside one browser window at
a time.
To create frames, we need <frameset> and <frame> tag.
1. <frameset> tag
Attributes Description
cols It specifies how many columns are to be contained in the frameset and
(Columns) the size of each column.
rows It works like the 'cols' attribute and takes the same values, but it is used
to specify the number of rows in the frameset.
border It specifies the width of the border of each frame in pixels. For
example; border = “5”. A value of zero means no border.
2. <frame> tag
<frame> tag is used to define a frame within a <frameset> tag.
A frame should be used within a <frameset> tag.
Syntax:<frame src=”frm1.htm”>
Attributes Description
src It is used to give the file name that should be located in the frame. Its
value can be any URL, for example, src= “/html/abc.html”
name It allows to give a name to a frame. This attribute is used to indicate that a
document should be loaded into a frame.
frameborde It specifies whether or not the borders of that frame are shown. This
r attribute overrides the value given in the frameborder attribute on the
<frameset> tag if one is given. This can take values either 1 (Yes) or 0
(No).
HTML Iframes
Iframe represents an HTML inline frame that contains another document.
An iframe is used to display a web page within a web page.
Syntax:
<iframe src="URL"></iframe>
Output:
<!DOCTYPE html>
<html>
<body>
<iframe width="600" height="200" name="iframe_a"></iframe>
<p><a href="http://careerride.com/" target="iframe_a">CareerRide.com</a></p>
</body>
</html>
Output:
HTML Forms
Form is a part of web page.
It is used to collect user input through elements like text fields, check box and radio button,
select option, text area, submit buttons and etc.
Form works like a container which consists of controls known as form elements.
The HTML <form> tag is used to create an HTML form.
Syntax:
<form action="Script URL" method="GET/POST">
form elements land layout tags
</form>
Form Attributes
Attribute Description
name Used to identify and retrieve values from each form on the web page.
Attribute Description
Size Used to specify the width of the text-input control in terms of characters
Maxlengt Used to specify the maximum number of characters a user can enter into a
h input field.
Output:
2. Creating password
A password field is nothing but the text box in which the characters typed by the user are
displayed as bullet or asterisks.
Output:
Output:
Output:
Output:
1. PURPOSE
Good web design always caters to the needs of the user. Are your web visitors looking for
information, entertainment, some type of interaction, or to transact with your business? Each
page of your website needs to have a clear purpose, and to fulfill a specific need for your website
users in the most effective way possible.
2. COMMUNICATION
People on the web tend to want information quickly, so it is important to communicate clearly,
and make your information easy to read and digest. Some effective tactics to include in your web
design include: organising information using headlines and sub headlines, using bullet points
instead of long windy sentences, and cutting the waffle.
3. TYPEFACES
In general, Sans Serif fonts such as Arial and Verdana are easier to read online (Sans Serif fonts
are contemporary looking fonts without decorative finishes). The ideal font size for reading
easily online is 16px and stick to a maximum of 3 typefaces in a maximum of 3 point sizes to
keep your design streamlined.
4. COLOURS
A well thought out colour palette can go a long way to enhance the user experience.
Complementary colours create balance and harmony. Using contrasting colours for the text and
background will make reading easier on the eye. Vibrant colours create emotion and should be
used sparingly (e.g. for buttons and call to actions). Last but not least, white space/ negative
space is very effective at giving your website a modern and uncluttered look.
5. IMAGES
A picture can speak a thousand words, and choosing the right images for your website can help
with brand positioning and connecting with your target audience. If you don’t have high quality
professional photos on hand, consider purchasing stock photos to lift the look of your website.
Also consider using infographics, videos and graphics as these can be much more effective at
communicating than even the most well written piece of text.
6. NAVIGATION
Navigation is about how easy it is for people to take action and move around your website. Some
tactics for effective navigation include a logical page hierarchy, using bread crumbs, designing
clickable buttons, and following the ‘three click rule’ which means users will be able to find the
information they are looking for within three clicks.
Placing content randomly on your web page can end up with a haphazard appearance that is
messy. Grid based layouts arrange content into sections, columns and boxes that line up and feel
balanced, which leads to a better looking website design.
Eye tracking studies have identified that people scan computer screens in an “F” pattern. Most of
what people see is in the top and left of the screen and the right side of the screen is rarely seen.
Rather than trying to force the viewer’s visual flow, effectively designed websites will work with
a reader’s natural behaviour and display information in order of importance (left to right, and top
to bottom).
9. LOAD TIME
Everybody hates a website that takes ages to load. Tips to make page load times more effective
include optimising image sizes (size and scale), combining code into a central CSS or JavaScript
file (this reduces HTTP requests) and minify HTML, CSS, JavaScript (compressed to speed up
their load time).
It is now commonplace to access websites from multiple devices with multiple screen sizes, so it
is important to consider if your website is mobile friendly. If your website is not mobile friendly,
you can either rebuild it in a responsive layout (this means your website will adjust to different
screen widths) or you can build a dedicated mobile site (a separate website optimised specifically
for mobile users).