Unit I Website Basics Edited1-1
Unit I Website Basics Edited1-1
Web Essentials: Clients, Servers and Communication – The Internet – World wide web –
HTTP Request Message – HTTP Response Message – Web Clients – Web Servers –
HTML5 – Tables – Lists – Image – HTML5 control elements – Drag and Drop – Audio –
Video controls - CSS3 – Inline, embedded and external style sheets – Rule cascading –
Inheritance – Backgrounds – Border Images – Colors – Shadows – Text – Transformations
– Transitions – Animations. Bootstrap Framework
Web technology is a technology that acts as an interface between web client and
web server. It includes markup languages, programming interfaces, online
presentation tools, Java applets, video editing tools and so on.
The commonly used client side scripting languages are HTML, JavaScript, CSS,
XML and so on.
The commonly used server side technologies are ASP, JSP, Java Servlets, PHP and so
on.
1 . 1 . 1 Concept of Internet
Using internet many people can share resources and can communicate with each
other. To have internet service one must go to the service providers. That
means your computer must be connected to the Internet Service Providers (ISP)
through phone-line modem or DSL.
Web Technology 1-2 Web Site Basics
There are some privately owned internet service providers from which we can
hire the internet services.
The term internet and WWW is often used interchangeably, but these are two different
terms.
The basic feature of HTTP protocol is that it follows the request response model.
The client makes a request for desired web page by giving the URL in the address
bar. This request is submitted to the web server and then web server gives the
response to the web browser by returning the required web page.
<Header fields>
<Blank Line>
<Message Body>
<start Line>
The start line consists of three parts which are separated by a single space.
(i) Request Method : Various methods used for making the request are enlisted in
the following table
HTTP Description
method
POST The POST method is used to request the server for desired web
page and the request made is accepted as a new subordinate of
the resource identified.
(ii) Request-URI:
The Uniform Resource Identifier (URI) is a string used to identify the names
or resources on the Internet.
The URI is a combination of URL and URN.
The URL stands for Uniform Resource Locator and URN stands for
Uniform Resource Name.
The web address denotes the URL and specific name of the place or a
person or itemdenotes the URN.
If the URI is written in the form of http: then it is both an URI and URL but
there are some other URI which can also be used as URL.
For example
URL Intended server
(iii) HTTP Version : The first HTTP version was HTTP/0.9 but the official version of
HTTP was HTTP/1.1
<Header Field> and <Message Body>
The header fields are in the form of field name and field value.
<Status line>
<Header fields>
<Blank Line>
<Message Body>
Status line is similar to the start line in the request message. It consists of three fields.
The HTTP version denotes the HTTP version such as HTTP/1.1. The status code is
a numeric code indicating the type of response. The reason phrase is in the text string
form and presents the information about the status code.
For example -
404 Not Found The requested resource is not present currently but
may be available in future.
<Header Fields>
<Message Body>
Date It represents the date and time at which the response is generated.
Last- The date and time at which the response is last modified.
Modified
Accept- It specifies the unit which is used by the client to accept the range
5. The HTTP protocol has a cache control. This is an advanced feature of HTTP.
Most of the web browsers automatically store(Cache) the recently visited web
pages. This is very useful feature because if the user requests the same web page
that has been visited already then it can be displayed from the cache memory
instead of requesting the web server and bringing it from there.
This software sends the HTTP request to the server and then processes the HTTP
response.
o Web browsers
o Software robots which crawl on the web for retrieving the information
Web browser is a kind of software which is basically used to use resources on the
web.
Over the networks, two computers communicate with each other. In this
communication, when request is made by one computer then that computer is
called a client and when the request gets served by another computer then that
computer is called server. Thus exchange of information takes place via Client-
Server communication.
When user wants some web document then he makes the request for it using the web
browser.
The browsers are the programs that are running on the clients’ machines. The
request then gets served by the server and the requested page is then returned to
the client. It is getting displayed to the client on the web browser.
The commonly used web browsers are (i) Internet explorer (ii) Mozilla Firefox
(iii) Netscape Navigator (iv) Opera (v) Google Chrome (vi) Safari.
Web browser supports variety of protocols but the most commonly used protocol
on the web browser is Hyper Text Transfer Protocol(HTTP). This protocol is
typically used when browser communicates with the server.
1.5.1 Functions Defined by Web Browser
2. When user gives the address of particular web site it is in the form of domain
name. The web browser coverts the DNS to corresponding IP address.
3. The web browser establishes a TCP connection with the Web browser while
processing the user’s request.
4. The web browsers send the HTTP request to the web server.
5. The web server processes the HTTP request sent by the web browser and returns
the desired web page to the client machine. The web browser on the client’s
machine displays this web page in appropriate format.
1.5.2 URL
The Uniform Resource Locator (URL) is unique address for the file that has to be
accessed over the internet.
When we want to access some website we enter it’s URL in the address bar of the web
browser.
The protocol identifier and the resource name are separated by a colon and two
forward slashes. The syntax of writing URL is as given below,
protocol://username@hostname/path/filename
Sometimes instead of domain name servers IP addresses can also be use. For example,
http://192.168.0.1
But use of IP address as URL is not preferred because human can not remember
numbers veryeasily but they can remember names easily.
The absolute URL is a URL which directly point to a file. It exactly specifies
exact location of a file or directory on the internet. Each absolute URL is unique.
For example - http://www.vtubooks.com/home.aspx
The relative URL points to the file or a directory in relation to the present
directory. For example
Consider the absolute address which refers an image mother.jpg
http://www.mywebsite.com/myphotos/mother.jpg
For the above given absolute address the relative address will be -
../myphotos/mother.jpg
That means from the current URL the directory myphotos will be searched for
the image mother.jpg. The two peroids .. instruct the server to move up one
directory which is the root directory, then enter myphotos directory (/myphotos)
and finally point at mother.jpg. Thus using relative URL writing of long path
name can be avoided.
1.6 Web Server AU : May-10,12,13 , Marks 12
Web server is a special type of server to which the web browser submits the
request of web page which is desired by the client.
There are some popularly used web servers such as Apache and IIS from Microsoft.
1. The web servers accepts the requests from the web browsers.
3. The web servers respond to the users by providing the services which they
demand for over the web browsers.
4. The web servers serve the web based applications.
6. The servers verify given address exists, find necessary files ,run appropriate
scripts exchange cookies if necessary and returns back to the browser.
7. Some servers actively participate in session handling techniques.
3) A database server.
Working
Step 1 : The client PC or web client submits the request for desired web page to
the web server.
Step 2 : The work of server is distributed among application server and database
servers.
Step 3 : The data required by this business logic is present on database server. The
required data is returned to application servers
Step 4 : The web server or application server prepares the response page and
2. This architecture is scalable. That means it can support increased number of users
and resources.
3. High degree of flexibility in deployment platform and configurations.
Disadvantages :
The XHTML syntax rules are specified by the file xhtml11.dtd file. Hence
specify the name ofthis file at the beginning of XHTML script.
1 The HTML tags are case The XHTML is case sensitive and all the tags in
. insensitive. Hence <body> or XHTML document must be written in lower
<BODY> or <Body> are case.
treated as one and the same.
2 We can omit the closing tags For every tag there must be a closing tag.
. sometimes in HTML Some browsers get confused if the closing tag is
document. not given. There are two ways by which we can
mention the closing tags
<a href =”TajMahal.html”>
</a> or
<a href=”Tajmahal.html”/>
It contains rich text. The rich text means text with tags.
Any HTML program can be written in simple Notepad or WordPad text editors.
The extension to this program should be either html or htm.
This program then can be opened in some web browser and the corresponding
web page can be viewed. Let us create our first web page using HTML.
Web Technology 2 - 18 HTML
HTML Document
<html>
<head>
<title>My webpage</title>
</head>
<body>
This is my first Web Page!!!
</body>
</html>
<head> section
<body> section.
Web Technology 2 - 19 HTML
In all HTML/XHTML documents the root element is <html> which has two
children : head and body.
Any text contained within the head element does not appear directly in the
client area of web browser. The head element is used for providing
certain information to web browser. The
<title> element is used to give title to the web page. Note that this title does
not appear in client area. Rather it appears at the top of web browser.
The <body> element contains the
information which is to be displayed
in the client area of web browser.
Web Technology 2 - 20 HTML
Tag Meaning
<h2> </h2>
<h3> </h3>
<h4> </h4>
<h5> </h5>
<h6> </h6>
<pre> This tag is used to preserve the white spaces and lines in the
text.
<font size=”” color=”” set the font, size and color of the text in the web page
face=””></font>
The biggest advantage of using tables on the web pages is that the information
gets arranged systematically.
The table is a matrix of rows and columns and the area formed due to intersection
of a row and a column is called cell.
TAG MEANING
Cell padding is the space between the cell edges and the cell content.
Sol. : resume.html
<html>
<head>
<title>RESUME APPLICATION</title>
</head>
<body>
<center><h2>RESUME</h2></center>
<a href="my_photo.jpg">PHOTO</a>
<br/><br/>
<strong>Name: </strong> Mr.Sachin Patil<br/>
<strong>Address: </strong> D10,SunEmpire,SunCityRd,Pune<br/>
<strong>Sex: </strong>Male<br/>
<strong>Phone: </strong>9229229221<br/>
<strong>Email: </strong>[email protected]
<br/><br/>
<strong>Educational Qualification:</strong>
<table border=2>
<tr>
<th>Examination</th>
<th>Year Of Passing</th>
<th>Board/University</th>
<th>Marks obtained</th>
</tr>
<tr>
Web Technology 2 - 26 HTML
<td>S.S.C</td><td>1991</td><td>Pune</td><td>93%</td>
</tr>
<tr>
<td>H.S.C</td><td>1993</td><td>Pune</td><td>90%</td>
</tr>
<tr>
<td>B.E.(Computer)</td><td>1997</td><td>Pune</td><td>72%</td>
</tr>
<tr>
<td>M.Tech(Computer)</td><td>2001</td><td>IIT(Kanpur)</td><td>A grade</td>
</tr>
</table>
<strong>
<br/><br/>
Programming Languages known:
</strong>
<ul>
<li>Cobol
<li>C
<li>C++
<li>Visual C++
<li>Visual Basic
<li>Java
</ul>
<br/><br/>
Web Technology 2 - 27 HTML
<div align=left>Date:</div>
<div align=right>Place:</div>
<br/>
<div align=left>Signature</div>
</body>
</html>
Output
2.6 IMAGES
Images can improve the design and the appearance of a web page.
Example
ATTRIBUTES
src="url" The src attribute specifies the URL (web address) of the image
alt=" " The alt attribute provides an alternate text for an image, if the user for some
reason cannot view it
There is a common practice to specify the web link in the web page. The link acts
as a pointer to some web page or some resource.
Use of hyperlink in the web page allows that page to link logically with other page.
<a>…</a> <a> means beginning of the web link and </a> means end of the web
link.
List is nothing but the collections of items or elements. There are two types of
lists - unordered lists and ordered lists.
The unordered list is useful for simply listing the items but if we want
the items in some specific sequence then the ordered lists are used
Web Technology 2 - 30 HTML
▫ Starts with <ul> tag. Each list item starts with <li> tag.
TAG MEANING
The ordered list is a list of items which must follows some specific sequence. We
can number the text using <ol> tag. Following table shows various styles by which the
list can be numbered.
Tags Meaning
Using multiple views we can keep certain information visible and at the same
time other views are scrolled or replaced.
For example, within the same window, one frame
can display a company information, a second frame
can be a navigation menu and a third frame may
display selected document that can be scrolled
through or replaced by navigating in the second
frame.
Various frames can be set in one browser window .
Form is a typical layout on the web page by which a user can interact with
the web page.
An HTML form is used to collect user input. The user input is most often
sent to a server for processing.
Let us learn various form components with the help of simple HTML
documents.
ELEMETS MEANING
<input type="radio"> Displays a radio button (for selecting one of many choices)
TEXT BOX
SUBMIT-BUTTON
BUTTON
CHECKBOX
RADIO BUTTON
DROP-DOWN LIST
2.11 HTML 5.0
5. It has support for new form controls such as number, date, time, calendar,
and range.
"http://www.w3.org/TR/xhtml1/DTD/xhtml1
1.dtd">
2. <audio> and <video> tags are not supported. <audio> and <video> tags are
supported for playing audio and
video files.
3. Finding out geographic location is The HTML5 supports the API for
impossible using HTML identifying the geographic
location.
4. It supports the tag such as <applet>, <big>, The tags that are removed from
<frame>, <strike>
7. It needs external plugins such as flash. The need for external plugin is
reduced.
2.12 HTML New Tag Elements –semantic elements
<aside > Represents a piece of content that is only slightly related to the rest of
the page.
<canvas> This is used for rendering dynamic bitmap graphics on the fly, such as
graphs or games.
<details> Represents additional information or controls which the user can obtain
on demand
Many web sites contain HTML code like: <div id="nav"> <div
class="header"> <div id="footer">to indicate navigation, header,
and footer.
HTML5 offers new semantic elements to define different parts
of a web page:
2.12.5 HTML5 <section> Element
The <section> element defines a section in adocument.
According to W3C's HTML5 documentation: "A section is a
thematic grouping of content, typicallywith a heading."
A home page could normally be split into sections for introduction,
content, and contact information.
<section>
<h1>WWF</h1>
<p>The World Wide Fund (WWF) is. .. </p>
</section>
Blog post
Newspaper article
<article>
<h1>What Does WWF Do?</h1>
<p>WWF's mission is to stop the degradation of
our planet's natural environment,
</article>
2.12.7.HTML5 <header> Element
The <header> element specifies a header for a document or section.
The <header> element should be used as a container for introductory
content.
The following example defines a header for an article:
Example
<article>
<header>
<h1>What Does WWF Do?</h1>
<p>WWF's mission:</p>
</header>
<p>WWF's mission is to stop the degradation of
our planet's natural environment, and build a
future in which humans live in harmony with
nature.</p>
</article>
2.12.8 HTML5 <footer> Element
The <footer> element specifies a footer for a document or section.
A <footer> element should contain information about its containing element.
A footer typically contains the author of the document, copyright
information, linksto terms of use, contact information, etc.
Example
<footer>
<p>Posted by: Hege Refsnes</p>
<p>Contact information:
<a href="mailto:[email protected]">
[email protected]</a>.</p>
</footer>
2.12.9 HTML5 <nav> Element
The <nav> element defines a set of navigation links.
Example
<nav>
<a href="/html/">HTML</a> |
<a href="/css/">CSS</a> |
<a href="/js/">JavaScript</a> |
<a href="/jquery/">jQuery</a>
</nav>
2.12.10 HTML5 <aside> Element
The <aside> element defines some content aside from the
content it is placed in (like a sidebar).
The <aside> content should be related to the surrounding content.
Example
<p>My family and I visited The Epcot center this summer.</p>
<aside>
<h4>Epcot Center</h4>
</aside>
2.12.11 HTML5 <figure> and <figcaption> Elements
The purpose of a figure caption is to add a visual explanation to an
image.
In HTML5, an image and a caption can be grouped together in a
<figure> element:
Example
<figure>
<img src="pic_trulli.jpg" alt="Trulli">
<figcaption>Fig1. - Trulli, Puglia, Italy.</figcaption>
</figure>
The dataTransfer.setData() method sets the data type and the value of the
dragged data:
function drag(ev)
{
ev.dataTransfer.setData("text",ev.target.id);
}
In this case, the data type is "text" and the value is the id of the draggable
element ("drag1").
The ondragover event specifies where the dragged data can be dropped.
event.preventDefault()
The <audio> tag contains one or more <source> tags with different audio
sources. The browser will choose the first source it supports.
The text between the <audio> and </audio> tags will only be displayed in
browsers that do not support the <audio> element.
There are three supported audio formats in HTML: MP3, WAV, and
OGG.
Attributes
autoplay autoplay Specifies that the audio will start playing as soon as it is ready
loop Loop Specifies that the audio will start over again, every time it is
finished
preload auto Specifies if and how the author thinks the audio should be
metadata loaded when the page loads
none
<html>
<body>
<audio controls>
</audio>
</body>
</html>
2.15 HTML Video Element
The <video> tag contains one or more <source> tags with different video
sources. The browser will choose the first source it supports.
The text between the <video> and </video> tags will only be displayed in
browsers that do not support the <video> element.
There are three supported video formats in HTML: MP4, WebM, and
OGG.
autoplay autoplay Specifies that the video will start playing as soon as it is
ready
loop loop Specifies that the video will start over again, every time it is
finished
muted muted Specifies that the audio output of the video should be muted
<html>
<body>
</video>
</body>
</html>
Web Technology 3 - 53 CSS
The Cascading Style Sheet is a markup language used in the web document
for presentation purpose.
The primary intension of CSS was to separate out the web content from the web
presentation.
Various elements such as text, font and color are used in CSS for presentation
purpose. Thus CSS specification can be applied to bring the styles in the web
document.
3.2 Features
CSS 3.0
It support for selectors, box model, Background and borders, Text effects,
Web Technology 3 - 54 CSS
animations, Multiple column layout, 3D transformations and so on.
The style specification is specified differently for each different level. For instance :
For inline cascading style sheets the style appears in side the tag for defining the value.
<p style="font-size: 30pt ;font-family:Script">
For the document cascading style sheet the style specification appear as the
content of a style element within the header of a document.
The type attribute tells the browser that what it is reading is text which is
affected by the Cascading Style Sheet. The type specification is necessary
because there is one more specification used in JavaScript.
The External style sheet makes use of style specification in the same manner as
in document cascading style sheet.
The most commonly used CSS properties are enlisted in the following table -
Fonts font
font-family
font-size
font-style
font-weight
Web Technology 3 - 55 CSS
font-face
Text letter-spacing
line-height
text-align
text-decoration
text-indent
background-color
background-image
background-position
background-repeat
color
Borders border
border-color
border-width
border-style
border-top
border-top-color
border-top-width
Spacing Padding
padding-bottom,
padding-left,
padding-right,
padding-top
Web Technology 3 - 56 CSS
margin
margin-bottom,
margin-left,
margin-right,
margin-top
3.4 Selectors
• Simple Selector
• Universal Selector
• Grouping Selector
• Class selector
• Id selector
3.4.1 Simple selector
Web Technology 3 - 57 CSS
3.4.2 Universal selector
3.4.5 Id selector
Web Technology 3 - 59 CSS
3.5 Style Sheet and HTML
The inline cascading style sheet is a kind of style sheet in which the styles can
be applied to HTML tags. This tag can be applied using following rule -
Tag
{
property: value
}
For example :
This type style sheet appears only in the head section and in the body section
newly defined Selector tags are used with the actual contents.
The most important thing while writing document level style sheet is that we
should mention the style type="text/css" in the head section. By this the
browser will come to know that the program is making use of cascading style
sheet.
Sometimes we need to apply particular style to more than one web documents in
such cases external style sheets can be used.
The central idea in this type of style sheet is that the desired style is stored in
one .css file. And the name of that file has to be mentioned in our web pages.
Then the styles defined in .css file will be applied to all these web pages.
Script Explanation
When we want to link the external style sheet then we have to use <link> tag
which is to be written in the head section.
link tells the browser some file must be linked to the page.
type="text/css" tells the browser that what it is reading is text which is affected
by the cascading style sheet.
Web Technology 3 - 62 CSS
An element inherits the value for its properties by checking the parent element. If
the parent has the value for the property demanded by the child then this property
value can be inherited. If the parent down not have this value, then its parent
(i.e. grandparent) is checked. If this parent has no such property value then its
parent is checked. This process is continued until a root element is obtained.
Thus the search will be made in upward direction from the parent of the element
to the root of the tree or to the <html> tag of the document.
HTML Document
<html>
<head>
<title>Inheritance Demo</title>
<style type="text/css">
Web Technology 3 - 64 CSS
p
{
font-family:Arial;
color:blue;
background-color:yellow;
}
strong
{
font-size:24px;
}
</style>
</head>
<body>
<center>
<p>This is a blue text <strong>with</strong> yellow background</p>
</center>
</body>
</html>
Output
Web Technology 3 - 65 CSS
The font properties can be setting different types of fonts, styles and sizes.
CSS PROPERTIES
font-family font-family:Arial;
font-size font-size:10pt;
font-style font-style:italic
font-weight font-weight:bold
font-variant font-variant:small-caps
text-decoration text-decoration:underline
<html>
<head>
<style type="text/css">
font-family:Courier New;
font-style:italic;
font-weight:bold;
font-size:28pt;
text-decoration:underline
text-align :right
}
</style>
Web Technology 3 - 66 CSS
</head>
<body>
</body>
</html>
BACKGROUND-COLOR
BACKGROUND-IMAGE
BACKGROUND-REPEAT
Web Technology L - 69 Web Technology Laboratory
BACKGROUND-ATTACHMENT
3.9 Borders
There is a property called border-style which controls the element’s content border.
border-style border-style:dotted
border-top-style:solid;
border-right-style:solid;
border-bottom-style:dashed;
border-left-style:dotted; OR
border-width border-width:3px;
border-color border-color:red;
Web Technology L - 70 Web Technology Laboratory
HTML Document[BorderStyle.html]
<html >
<head>
<style type="text/css">
h4.none {border-style:none}
h4.dotted {border-style:dotted}
h4.dashed{border-style:dashed}
h4.solid {border-style:solid}
h4.double {border-style:double}
h4.groove{border-style:groove}
h4.ridge {border-style:ridge}
h4.inset {border-style:inset}
h4.outset{border-style:outset}
h4.hidden {border-style:hidden}
</style>
</head>
<body>
</body>
</html>
Output
Web Technology L - 71 Web Technology Laboratory
HTML Document[BorderColor.html]
<html>
<head>
<style type="text/css">
h4
{
border-style:solid;
border-width:3px;
border-color:red;
}
</style>
</head>
<body>
</body>
</html>
3.10 Margins
Margin means the space between the content and its neighbouring content.
There can be top margin, bottom margin, left margin and right margin. Hence
various properties of margins are margin-top, margin-bottom, margin-left and
margin-right. The values of these properties can be given in px and in.
HTML Document[MarginDemo.html]
<!DOCTYPE html>
<html>
<head>
<style
type="text/css">
p
{
border-style:solid;
margin-top:80px;
margin-bottom:60px;
margin-left:30px;
margin-right:70px;
}
</style>
</head>
<body>
<p>Text</p>
</body>
</html>
Web Technology L - 73 Web Technology Laboratory
Output
3.11 Padding
Padding means the space between the contents and its border. Various
properties of padding are padding-left, padding-right, padding-top and padding
bottom. These values can also be given in px or in in.
HTML Document[PaddingDemo.html]
<html>
<head>
<style
type="text/css">
p
{
border-style:solid;
padding-top:70px;
padding-bottom:50px;
padding-left:120px;
padding-right:60px;
}
</style>
</head>
<body>
<p>My Text</p>
</body>
</html>
Web Technology L - 74 Web Technology Laboratory
Using color property we can set the foreground color and using background-
color the background color can be set. The use of these properties is shown in
XHTML document.
<html>
<head>
<style>
h1
{
font-
family:Arial;
color:green;
background-color:yellow;
</style>
</head>
<body>
<center>
</center>
</body>
</html>
CSS3 Colors
RGBA Colors
RGBA color values are an extension of RGB color values with an alpha
channel - which specifies the opacity for a color.
Web Technology L - 75 Web Technology Laboratory
The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully
opaque)
rgba(255, 0, 0, 0.2);
rgba(255, 0, 0, 0.4);
rgba(255, 0, 0, 0.6);
rgba(255, 0, 0, 0.8);
HSL Colors
● 120 is green
● 240 is blue
example.html
<html>
<head>
<style>
#p1 {background-color:rgba(255,0,0,0.3);}
#p2 {background-color:rgba(0,255,0,0.3);}
Web Technology L - 76 Web Technology Laboratory
#p3 {background-color:hsl(120,100%,25%);}
#p4 {background-color:hsl(120,60%,70%);}
</style>
</head>
<body>
<p>RGBA colors:</p>
<p id=”p1">Red</p>
<p id=”p2">Green</p>
<p>HSL colors:</p>
</body>
</html>
1. box-shadow 3. border-image
The box-shadow property represents the shadows around the border. For example-
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 300px;
height: 100px;
background-color: yellow;
box-shadow: 10px 20px 5px blue;
}
</style>
</head>
<body>
<div> </div>
</body>
</html>
<head>
<style>
div {
background-color: pink;
border: 20px solid transparent;
border-image-source: url('flower.png');
border-image-slice: 20;
border-image-repeat: repeat;
}
</style>
</head>
<body>
<div>
This design has a image border
</div>
</body>
</html>
#borderimg {
border: 10px solid transparent;
padding: 15px;
• Here, the middle sections of the image are repeated to create the border:
Property Description
In this section we will discuss various text effects mainly used in CSS3.
The CSS3 allows to incorporate many advanced text effects in the web design.
Out of which the text shadow effect is very commonly used.
Web Technology L - 80 Web Technology Laboratory
Let us now understand how to apply and experience this text style.
<html>
<head>
<style>
h2 {
text-shadow: -5px 15px 3px gray;
}
</style>
</head>
<body>
Box Shadows
Boxshadow.html
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 300px;
height: 100px;
padding: 15px;
background-color: yellow;
box-shadow: 10px 10px;
}
</style>
</head>
<body>
</body>
</html>
3.14 CSS3 Animations
When you specify CSS styles inside the @keyframes rule, the animation
will gradually change from the current style to the new style at certain
times.
Web Technology L - 82 Web Technology Laboratory
@keyframes
animation-name
animation-duration
animation-delay
animation-iteration-count
animation-direction
animation-timing-function
animation-fill-mode
animation
To get an animation to work, you must bind the animation to an element. The
following example binds the “example” animation to the <div> element.
Property Description
Example 1:
@keyframes example
{
from {background-color: red;}
to {background-color: yellow;}
}
Div
{
width: 100px;
height: 100px;
background-color: red;
animation-name: example;
animation-duration: 4s;
}
Example 2 :
@keyframes example
{
0% {background-color: red;}
25% {background-color: yellow;}
50% {background-color: blue;}
100% {background-color: green;}
}
Div
{
width: 100px;
height: 100px;
background-color: red; animation-name: example; animation-
duration: 4s;
animation-delay: 2s;
animation-iteration-count: 3;
animation-direction: reverse;
}
● CSS3 transitions allows you to change property values smoothly (from one
value to another), over a given duration.
● Note: If the duration part is not specified, the transition will have no effect,
because the default value is 0.
Property Description
transition-timing-function
ease - specifies a transition effect with a slow start, then fast, then end slowly
(this is default)
linear - specifies a transition effect with the same speed from start to end
transition-delay
CSS3 Transforms
● CSS3 transforms allow you to translate, rotate, scale, and skew elements.
Value Description
translateX(x) Defines a translation, using only the value for the X-axis
axis