Web Technologies, Handout 1 by G Sreenivasulu
Web Technologies, Handout 1 by G Sreenivasulu
Sreenivasulu Handout - 1 1
MODULE- I
INTRODUCTION:
HTML stands for Hyper Text Markup Language.HTML is a language for describing web
pages.HTML is a language for describing web pages.HTML instructions divide the text of a
document into blocks called elements.
Tags are used to mark up the start and end of an HTML element. A start tag consists of an
opening angle bracket (<) followed by the element name, zero or more space separated
attribute/value pairs, and a closing angle bracket (>).
End tags consist of an opening angle bracket followed by a forward slash, the element
name, and a closing angle bracket </p>
A HTML page has two sections (Elements) HEAD , BODY. The head is used for text and
tags that do not show directly on the page. The body is used for text and tags that are
shown directly on the page .
TITLE, META are the Elements that appear within HEAD element.
The title of a webpage appears in your browser´s title bar when you view the page.
The META element used in the HEAD section is an empty element, i.e. the META element
consists only of an opening tag. The most important use for this element is to give the search
engines some basic information about your HTML document such as the most important
keywords that appear inside the document and a short description of the document´s content.
MIME types:
The World Wide Web actually uses MIME types (Multipurpose Internet Mail Extension) to
define the type of a particular piece of information being sent from a Web server to a browser.
A browser in turn determines, from the MIME type, how the data should be treated.
HTML Headings are defined with the <H1> to <H6> tags.<H1> defines the
largest heading. <H6> defines the smallest heading.
<H1>This is h1</H1>
<H2>This is h2</H2>
<H3>This is h3</H3>
<H4>This is h4</H4>
<H5>This is h5</H5>
<H6>this is h6</H6>
Example 1: ( Type the following code in Note pad editor , save as ex1.html and open in a browser)
<html>
<body>
<h4>Branches
Available:</h4> <ul
type="disc"> <li>CSEe</li>
<li>ECE</li>
<li>EEE </li>
</ul>
</body>
</html>
Note : <ul type="circle"> , <ul type="square"> are used to get Circle and Square symbols.
Note: <ol type="A"> ,<ol type="a"> , <ol type="I"> , <ol type="i"> are used to create List
with Capital Letters , Small Letters, Capital Roman Numbers, Small Roman Numbers as
Numbers for the Lists.
Definition Lists is not a list of single items. It is a list of items (terms), with a description of
each item (term). A definition list starts with a <dl> tag (definition list). Each term starts with a
<dt> tag (definition term). Each description starts with a <dd> tag (definition description)
Example:
<html>
<body>
<dl>
<dt>Cascading Style Sheets</dt>
<dd><p>Style sheets are used to provide presentational suggestions.</p>
<p>Documents structured using XML or HTML are able to make use of
them.</p></dd> <dt>Content Management</dt>
<dd>The process of collecting, managing and publishing content to various
media.</dd> </dl>
</body>
</html>
Tables
Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag), and
each row is divided into data cells (with the <td> tag). The letters td stands for "table data,"
which is the content of a data cell. A data cell can contain text, images, lists, paragraphs,
forms, horizontal rules, tables, etc.
Example
<html>
<body>
<table
border="1"> <tr>
<td>Table cell 1</td><td>Table cell
2</td> </tr>
<tr>
<td>Table cell 3</td><td>Table cell
4</td> </tr>
</table>
</body>
</html>
Example
<html>
<body>
<table border="1"
> <tr>
<th colspan="2">Table
header</th> </tr>
<tr>
<td width="20%">Table cell 1</td><td>Table cell
2</td> </tr>
</table>
</body>
</html>
HTML Images
To embed an image into a web page, the image first needs to exist in either .jpg, .gif, or
.png format To embed the image into your web page, use the <img /> tag,
src -- Required attribute. This is the path to the image. It can be either an absolute path, or
a relative path width --- This specifies the width to display the image. height -- This
specifies the height to display the image. alt Alternate text. This specifies text to be used in
case the browser/user agent can't render the image.
Frames: With frames, you can display more than one HTML document in the same browser
window. Each HTML document is called a frame, and each frame is independent of the others.
The frameset
(frameset1.html): <html>
<head>
<title>Frameset
page<title> </head>
<frameset cols = "25%, *">
<frame src ="left.html" />
<frame src ="right.html" />
</frameset>
</html>
<html>
<body style="background-color:green">
<p>This is the left frame </p>
</body>
</html>
<html>
<body style="background- color:yellow">
<p>This is the right frame </p>
</body>
</html>
Forms
A form is an area that can contain form elements. Form elements are elements that
allow the user to enter information . A form is defined using the <form></form> tags.
The Input Tag
This is the most commonly used tag within HTML forms . It allows you to specify
various types of user input fields such as text, radio buttons, checkboxes etc.
Text
Text fields are used for when you want the user to type text or numbers into
the form. <input type="text" >
Example :
<html>
<body>
<form action="MAILTO:g.sreenivasulu2@gmail.com" method="post"
enctype="text/plain"> Name: <input type="text" name="name" size="20"> <br>
e-mail <input type="text" name="mail" size="20"> <br>
Comments: <input type="text" name="comment" size="40">
<br> <br> <input type="submit" value="Send"> <input
type="reset"
value="Reset"> </form>
</body>
</html>
Radio Button
Radio Buttons are used when you want the user to select one of a limited
number of choices. <form>
<input type="radio" name="sex" value="male"
/> Male <br />
<input type="radio" name="sex" value="female"
/> Female </form>
Checkboxes
Checkboxes are used when you want the user to select one or more options of a
limited number of choices.
<form action="">
I have a bike:
<input type="checkbox" name="vehicle"
value="Bike"> <br />
I have a car:
<input type="checkbox" name="vehicle"
value="Car"> <br />
I have an airplane:
<input type="checkbox" name="vehicle"
value="Airplane"> </form>
<textarea rows="10" cols="30"> The cat was playing in the garden. </textarea>
<form>
Username: <input type="text" name="user"> <br>
Password: <input type="password"
name="password"> </form>
<select>
<option>California -- CA</option>
<option>Colorado -- CO</option>
<option selected="yes">Conneticut -- CN</option>
</select>
<select size="3">
<option>California -- CA</option>
<option>Colorado -- CO</option>
<option>Connecticut -- CN</option>
</select>
<select multiple="yes" size="3">
<option>California -- CA</option>
<option>Colorado -- CO</option>
<option>Connecticut -- CN</option>
</select>
CSS is the acronym for: ‘Cascading Style Sheets’. CSS is an extension to basic HTML
that allows you to style your web pages.
A typical CSS statement will SELECTOR { PROPERTY: VALUE } Property" is the CSS
element you wish to manipulate and "VALUE" represents the value of the specified property.
Example
p {color: white; }
body {background-color: black; }
<head>
<style type="text/css">
body {background-color:
red} p {margin-left: 20px}
</style>
</head>
Inline Styles
An inline style should be used when a unique style is to be applied to a single occurrence
of an element.
Class
Class is specified by including a period (.) before the selector name. The syntax for
declaring a Class selector is as follows:
.navbar {
color:#0000FF;
}
<p class="navbar">This is a sample using a Class selector.</p>
ID
ID is specified by including a number sign (#) before the selector name. The syntax for
declaring an ID selector is as follows:
#footer {
color:#FF00FF
;
}
The difference between ID and class is that an ID selector can be called only once in a
document, while a class selector can be called multiple times in a document. The second
difference is that ID can be called by Javascript's getElementByID function.
There is no hard rule on when to use ID and when to use Class. My suggestion is to use
class as much as possible for maximum flexibility, with the only exception being when you
want to use Javascript's getElementByID function, in which case you need use ID.
Class and ID names are both case sensitive. For example, .classone and .ClassOne are two different
classes.
DIV The div element is the generic block element. You can use div to apply styles to
large sections of HTML, such as multiple paragraphs.
<div style="color:#00FF00">
<h3>This is a header</h3>
<p>This is a paragraph.</p>
</div>
SPAN The span element is the generic inline element. Used over a span.
<p> My friend has <span Style = "color:lightskyblue;font-weight:bol" >light blue</span> eyes
CSS Properties are divided into the below given logical groups
● Height
● Float
● Clear
CSS Color Properties
The CSS color property defines what color the text inside the specified HTML element
will have h4 { color: red; } , h5 { color: #9000A1; } , h6 { color: rgb(0, 220, 98); }
CSS Background Properties
The CSS background properties control things like if the background is a single color or
maybe an image
● Background
● Background Color
● Background Image
● Background Repeat
● Background Attachment
● Background Position