CP301 CH - 3 HTML
CP301 CH - 3 HTML
(CP301)
Reference Book(s):
1. Developing Web Application, Ralph Moseley, Wiley India
2. Web Design, Joel Sklar, Cengage Learning
Chapter 3:
HTML also provides tags to make the document look attractive using
graphics, font size and colors.
User can make a link to the other document by creating Hypertext Links
also known as Hyperlinks.
Website Development Process
A Web site is composed of individual pages that are linked together each of
these relating to a different aspects of your site such as news , links and
biography.
The essential tags that are required to create a HTML document are:
<html>.............</html>
<head>.............</head>
<body>.............</body>
Basic HTML
<HTML>
Your Title and Document (contains text with HTML tags)
goes here
</HTML>
the document a title that displays on the browsers title bar at the top.
<HEAD>
<TITLE>
Your title goes here
</TITLE>
</HEAD>
Basic HTML
the HTML tags that are used for control and formatting of the page.
<BODY>
Your Document goes here
</BODY>
Example:
<HTML>
<HEAD>
<TITLE>
My first Page
</TITLE>
</HEAD>
<BODY>
WELCOME TO MY FIRST
WEB PAGE
</BODY>
</HTML>
Basic HTML
<BODY BGCOLOR="yellow">
Your document text goes here.
</BODY>
TEXT: used to set the color of the text of the document
<BODY TEXT="red">
Document text changed to red color
</BODY>
BACKGROUND: It is used to point to an image file (the files with an
extension .gif, .jpeg) that will be used as the background of the
document.
<BODY BACKGROUND="filename.jpeg"> <
Document background changed
/BODY>
Basic HTML
<BODY VLINK=“yellow">
Document visited link color changed to yellow
</BODY>
Basic HTML
empty tags. Line break <BR> or <BR /> and <HR /> tags are empty
tags.
Basic HTML
<FONT> Tag:
Attributes of <FONT> are:
COLOR: Sets the color of the text that will appear on the screen. It
can be set by giving the value as #rr0000 for red or by name.
SIZE: Sets the size of the text, takes value between 1 and 7, default is
3.
FACE: Sets the normal font type, provided it is installed on the user’s
machine. <FONT FACE="ARIAL"> bvm </FONT>
Basic HTML
START : Used for lists that need to start at values other than 1.
START always specified in default numbers, and is completed based
on TYPE before display, For example, If START =5 it would display
either an ‘E’, ‘e’, ‘V’, ‘v’, or ‘5’ based an TYPE attribute.
TYPE : allows marking list items with different types. By default the
list Item markers are set to numbers 1,2,3… so on.
<OL type=“ï”>
Example:
<IMG SRC=logo.gif>
Example:
</A>
Basic HTML
<A HREF="document.html#section_name">
A different server:
<A HREF="http://www.bv
mengineering.ac.in/foldername/doc1.html#section
_name>
Basic HTML
Tables <TABLE>:
A table is divided into rows <tr> and each row is divided into data cells
<td>.
A data cell can contain text, images, lists, paragraphs, forms, horizontal
rules, tables, etc.
Example : <table border="1">
<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>
Basic HTML
<FORM> Elements:
<INPUT> tag is used to collect information from the user.
Different Types of Input:
<FORM> Elements:
Different Types of Input:
<input type=“button”/>
<input type=“image”/>
<input type=“reset”/>
<input type=“hidden”/>: allows hidden data to be
passed along with form. (not seen by user)
<textarea name=“add1” id=“add11” rows=“10” cols=“10”>
Basic HTML
<FORM> Elements:
Drop Down Menu:
A SELECT element presents a set of options to the user
</SELECT>
Basic HTML
<FORM> Elements:
Drop Down Menu:
</SELECT>
Basic HTML
<FORM> Elements:
List Box:
List boxes are used when multiple selections are permitted or a
specific visible size has been specified.
</SELECT>
Basic HTML
www.mywebsite.co.in
index.html ( homepage)
Department ( All department related files (pages))
Images ( images and other files (pages))
CSS (All CSS files)
JS (All JavaScript files)
Introduction to XHTML
<html>
<head>……..</head>
<body>……..</body>
</html>
If an HTML tag is not a container, close it like this :
<br />, <hr />, <img src=“smile.gif” />
Introduction to XHTML
META tag:
Metadata is information about information in this context machine
understandable information about web resources.
It can be included in both HTML and XHTML to describe the actual
documents rather than the document’s content.
Metadata is included in the head section of web page.
Meta tags are used to provide information to search engine. They
pick up the data you give and also control some extent where they go
on your site following links.
Introduction to XHTML
META tag:
<html>
<head>
</head>
</html>
Introduction to XHTML
META tag:
<html>
<head>
</head>
</html>
Introduction to XHTML
Character Entities:
< , >, &, ÷, ©, ®, ".
Frameset:
<frame> and <noframes> tags:
Dividing content on website when it is large, then use frames to
Frameset Example:
</frameset>
Introduction to XHTML
<noframe>:
Only give a body section to such a program where you want to
suppose browsers that don’t have frame capability.
<noframes>
<body>
</body>
</noframe>
Introduction to HTML5
HTML5 is the newest version of HTML, only recently gaining partial support by
the makers of web browsers.
Reduce the need for external plugins and scripts to show website content.
Make the rendering of web content universal and independent of the device
being used.
<!DOCTYPE html>
The DOCTYPE tells the browser which type and version of document to expect.
This should be the last time the DOCTYPE is ever changed. From now on, all
future versions of HTML will use this same simplified declaration.
First Look at HTML5
<html lang="en">
The lang attribute in the <html> element declares which language the page
content is in. Though not strictly required, it should always be specified, as it can
assist search engines.
Each of the world’s major languages has a two-character code, e.g. Spanish = "es",
French = "fr", German = "de", Chinese = "zh", Arabic = "ar".
First Look at HTML5
Notice the simplified character set declaration, the shorter CSS stylesheet link
text, and the removal of the trailing slashes for these two lines.
First Look at HTML5
Putting the prior sections together, and now adding the <body> section and
closing tags, we have our first complete web page in HTML5:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My First HTML5 Page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<p>HTML5 is fun!</p>
</body>
</html>
First Look at HTML5
Even though we used HTML5, the page looks exactly the same in a web browser
as it would in XHTML. Without looking at the source code, web visitors will not
know which version of HTML the page was created with.
HTML5 Basic Elements
header, nav and footer are not doing fancy things like the other new HTML5
elements, but these elements are primarily designed to make the web
structure more meaningful both for browsers and humans, just like how the
World Wide Web inventor, Tim Barners-Lee, think of it.
HTML5 Basic Elements
HTML5 Elements: Video
<!DOCTYPE HTML>
<html>
<body>
<video src="movie.ogg" width="320" height="240"
controls="controls">
Your browser does not support the video
tag.
</video>
</body>
</html>
The above example uses an Ogg file, and will work in Firefox, Opera and Chrome.
To make the video work in Safari and future versions of Chrome, we must add an
MPEG4 and WebM file.
HTML5 Elements: Video
<!DOCTYPE HTML>
<html>
<body>
</video>
</body>
</html>
HTML5 Elements: Video
HTML5 Elements: Audio
<!DOCTYPE HTML>
<html>
<body>
<audio controls="controls">
<source src="song.ogg" type="audio/ogg" />
<source src="song.mp3" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>
</body>
</html>
HTML5 Elements: Audio
HTML5 Elements: Input Types