CSS3
CSS3
• Selectors
• Box Model
• Text Effects
• 2D/3D Transformations
• Animations
• User Interface
CSS3 Animation:
An Animation is such a property of CSS3, which is used to animate the object, without
using flash or any other animation application. With this feature of CSS3 You can
change the object into one style to another style in an animated way..
Syntax
Legal values:
0-100%
to (same as 100%)
Bind the animation to a selector by specifying at least these two CSS3 animation
properties:
• Specify the name of the animation
You can change as many styles you want, as many times you want.
• Specify when the change will happen in percent, or the keywords "from" and
"to", which is the same as 0% and 100%.
<!DOCTYPE html>
<html>
<head>
<style>
div
width:100px;
height:100px;
background:red;
animation:myfirst 5s;
@keyframes myfirst
from {background:green;}
to {background:yellow;}
from {background:green;}
to {background:yellow;}
}
</style>
</head>
<body>
<div></div>
</body>
</html>
===================================================
<!DOCTYPE html>
<html>
<head>
<style>
div
width:100px;
height:100px;
background:red;
animation:myfirst 5s;
@keyframes myfirst
0% {background:red;}
25% {background:yellow;}
50% {background:blue;}
100% {background:green;}
20% {background:red;}
25% {background:yellow;}
50% {background:blue;}
100% {background:green;}
</style>
</head>
<body>
<div></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div
width:100px;
height:100px;
background:red;
position:relative;
animation:myfirst 5s;
@keyframes myfirst
</style>
</head>
<body>
<div></div>
</body>
</html>
Syntax
animation-duration: time;
Value Description
time Specifies the length an animation takes to finish. Default value is 0, meaning
there will be no animation
<!DOCTYPE html>
<html>
<head>
<style>
div
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove 5s infinite;
@keyframes mymove
from {top:0px;}
to {top:200px;}
from {top:0px;}
to {top:200px;}
}
</style>
</head>
<body>
<div></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove 5s infinite;
@keyframes mymove
</style>
</head>
<body>
<div></div>
</body>
</html>
<!DOCTYPE html>
<html>
<style>
#animated_div
text-align:center;
width:60px;
height:40px;
background:#6699FF;
color:#ffffff;
position:relative;
font-weight:bold;
font-size:20px;
padding:10px;
animation:animated_div 5s infinite;
-moz-animation:animated_div 5s infinite;
-webkit-animation:animated_div 5s infinite;
border-radius:5px;
-webkit-border-radius:5px;
@keyframes animated_div
0% {left:0px;}
@-webkit-keyframes animated_div
0% {left:0px;}
@-moz-keyframes animated_div
0% {left:0px;}
</style>
<body>
<div id="animated_div">
CSS3
</div>
</body>
</html>
Multiple Columns:
A Multiple Columns is such an advance feature of CSS3 which is used for creating the
newspaper layout. You can create your articles to Multiple Columns, even if it is in one
paragraph.
• column-count
• column-rule
• column-gap
<!DOCTYPE html>
<html>
<head>
<style>
.newspaper
-moz-column-count:3; /* Firefox */
column-count:3;
</style>
</head>
<body>
<div class="newspaper">
We take the challenge to help you begin your career with a boost as our
training faculty will help you to become ready for the IT career and face
the upcoming challenges of life. We have designed our curriculum as per
market working standards which helps you to gain professional knowledge
under the guidance of our professional faculties who have years of market
experience. We make you feel comfortable during your learning process at
our training centre. We believe in practical sessions which are fun and gets
you live experience of working environment.
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
.newspaper
-moz-column-count:3; /* Firefox */
column-count:3;
-moz-column-gap:40px; /* Firefox */
column-gap:40px;
</style>
</head>
<body>
<div class="newspaper">
We take the challenge to help you begin your career with a boost as our
training faculty will help you to become ready for the IT career and face
the upcoming challenges of life. We have designed our curriculum as per
market working standards which helps you to gain professional knowledge
under the guidance of our professional faculties who have years of market
experience. We make you feel comfortable during your learning process at
our training centre. We believe in practical sessions which are fun and gets
you live experience of working environment.
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
.newspaper
-moz-column-count:3; /* Firefox */
column-count:3;
-moz-column-gap:40px; /* Firefox */
-webkit-column-gap:40px; /* Safari and Chrome */
column-gap:40px;
</style>
</head>
<body>
<div class="newspaper">
We take the challenge to help you begin your career with a boost as our
training faculty will help you to become ready for the IT career and face
the upcoming challenges of life. We have designed our curriculum as per
market working standards which helps you to gain professional knowledge
under the guidance of our professional faculties who have years of market
experience. We make you feel comfortable during your learning process at
our training centre. We believe in practical sessions which are fun and gets
you live experience of working environment.
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
.newspaper
column-width:100px;
-moz-column-width:100px; /* Firefox */
</style>
</head>
<body>
<div class="newspaper">
We take the challenge to help you begin your career with a boost as our
training faculty will help you to become ready for the IT career and face
the upcoming challenges of life. We have designed our curriculum as per
market working standards which helps you to gain professional knowledge
under the guidance of our professional faculties who have years of market
experience. We make you feel comfortable during your learning process at
our training centre. We believe in practical sessions which are fun and gets
you live experience of working environment.
</div>
</body>
</html>
The column-span property specifies how many columns an element should span
across
<!DOCTYPE html>
<html>
<head>
<style>
.newspaper
column-count:3;
-moz-column-count:3; /* Firefox */
h2
column-span:all;
</style>
</head>
<body>
<div class="newspaper">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis
autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et
accumsan et iusto odio dignissim qui blandit praesent luptatum zzril
delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum
soluta nobis eleifend option congue nihil imperdiet doming id quod mazim
placerat facer possim assum. Typi non habent claritatem insitam; est usus
legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt
lectores legere me lius quod ii legunt saepius.
</div>
</body>
</html>
The column-rule-width property specifies the width of the rule between columns.
<!DOCTYPE html>
<html>
<head>
<style>
.newspaper
column-count:3;
column-gap:40px;
column-rule-style:outset;
column-rule-width:10px;
/* Firefox */
-moz-column-count:3;
-moz-column-gap:40px;
-moz-column-rule-style:outset;
-moz-column-rule-width:10px;
-webkit-column-gap:40px;
-webkit-column-rule-style:outset;
-webkit-column-rule-width:1px;
</style>
</head>
<body>
<div class="newspaper">
We take the challenge to help you begin your career with a boost as our
training faculty will help you to become ready for the IT career and face
the upcoming challenges of life. We have designed our curriculum as per
market working standards which helps you to gain professional knowledge
under the guidance of our professional faculties who have years of market
experience. We make you feel comfortable during your learning process at
our training centre. We believe in practical sessions which are fun and gets
you live experience of working environment.
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
#multiple_columns
text-align:justify;
column-count:3;
-webkit-column-count: 3;
-moz-column-count: 3;
column-gap: 40px;
-webkit-column-gap: 40px;
-moz-column-gap: 40px;
</style>
</head>
<body>
<div id="multiple_columns">
We take the challenge to help you begin your career with a boost as our
training faculty will help you to become ready for the IT career and face
the upcoming challenges of life. We have designed our curriculum as per
market working standards which helps you to gain professional knowledge
under the guidance of our professional faculties who have years of market
experience. We make you feel comfortable during your learning process at
our training centre. We believe in practical sessions which are fun and gets
you live experience of working environment.
</div>
</body>
</html>
Text Effects:
A CSS3 Text Effect is a such term which is used to implement some extra features
on normal text. CSS3 Text Effect is used to extend the text features for viewing and
layout purpose.
Their are mainly two properties of CSS3 Text Effects, which have been described as
follows:
• text-shadow
• word-wrap
text-shadow is used to create the shadow around the text, We can change the
shadow color
<!DOCTYPE html>
<html>
<head>
<style>
h1
</style>
</head>
<body>
<h1>Welcome</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
.test
width:11em;
word-wrap:break-word;
</style>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
#text_shadow
#word_wrap
word-wrap:break-word;
width:150px;
border:1px solid #ff0000;
#no_wrap
width:150px;
</style>
</head>
<body>
</body>
</html>
Fonts:
The rule for defining the Fonts is only We have to declare a name in the first line of
starting css properties. The font file can found in ttf(True type font) format or
otf(Open type font) format.
@font-face rule you must first define a name for the font (e.g. myFont), and then
point to the font file
<!DOCTYPE html>
<html>
<head>
<style>
@font-face
font-family: myFont;
src: url(sansation_light.woff);
@font-face
font-family: myFont;
src: url(sansation_bold.woff);
font-weight:bold;
div
{
font-family:myFont;
</style>
</head>
<body>
<div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
@font-face
font-family: myFont;
src: url(sansation_light.woff);
@font-face
{
font-family: myFont;
src: url(sansation_bold.woff);
font-weight:bold;
div
font-family:myFont;
</style>
</head>
<body>
<div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?
family=Cherry+Cream+Soda|Ropa+Sans|Butcherman|Rochester|
Open+Sans+Condensed:300' rel='stylesheet' type='text/css'/>
<style>
.font1
font-size: 14px;
color: yellow;
line-height: 1.3em;
.font2
font-size: 14px;
color: green;
line-height: 1.3em;
.font3
font-size: 14px;
color: red;
line-height: 1.3em;
.font4
font-size: 14px;
color: blue;
line-height: 1.3em;
.font5
font-size: 14px;
color: pink;
line-height: 1.3em;
</style>
</head>
<body>
</body>
</html>
Transition Effects:
A CSS3 Transition Effect is a such an effect that lets an element gradually change from
one style to another style. CSS3 Transition Effect is best suited for animation uses. But
still a lot can be done without using the animation. A user interface is necessary to
see the effects of transition. The all major browser support the CSS3 Transition Effects.
There are mainly four properties of CSS3 Transition Effects, which has been
described as follows:
• transition-property
• transition-duration
• transition-timing-function
• transition-delay
transition-property: all;
transition-property: none;
transition-property: background-color;
transition-duration: 2s;
transition-duration: 1000ms;
transition-timing-function: ease;
transition-timing-function: ease-in;
transition-timing-function: ease-in-out;
transition-delay: 2s;
transition-delay: -2s;
<!DOCTYPE html>
<html>
<head>
<style>
div
width:100px;
height:100px;
background:gray;
transition:width 6s;
div:hover
width:500px;
</style>
</head>
<body>
<div></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div
width:100px;
height:100px;
background:gray;
div:hover
width:200px;
height:200px;
transform:rotate(180deg);
-webkit-transform:rotate(180deg); /* Safari */
</style>
</head>
<body>
<div>welcome</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div
width:100px;
height:100px;
background:gray;
transition-property:width;
transition-duration:1s;
transition-timing-function:linear;
transition-delay:3s;
/* Safari */
-webkit-transition-property:width;
-webkit-transition-duration:1s;
-webkit-transition-timing-function:linear;
-webkit-transition-delay:3s;
}
div:hover
width:300px;
</style>
</head>
<body>
<div></div>
</body>
</html>
Syntax
transition-timing-function: linear|ease|ease-in|ease-out|ease-in-out|cubic-
bezier(n,n,n,n);
linear Specifies a transition effect with the same speed from start to end
(equivalent to cubic-bezier(0,0,1,1))
ease Specifies a transition effect with a slow start, then fast, then end
slowly (equivalent to cubic-bezier(0.25,0.1,0.25,1))
ease-in-out Specifies a transition effect with a slow start and end (equivalent
to cubic-bezier(0.42,0,0.58,1))
cubic-bezier(n,n,n,n) Define your own values in the cubic-bezier function.
Possible values are numeric values from 0 to 1
<!DOCTYPE html>
<html>
<head>
<style>
div
width:100px;
height:100px;
background:gray;
transition:width 2s;
transition-timing-function:ease;
/* Safari */
-webkit-transition:width 2s;
-webkit-transition-timing-function:ease;
div:hover
width:300px;
</style>
</head>
<body>
<div></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div
width:100px;
height:100px;
background:gray;
transition-property:width;
transition-duration:5s;
/* Safari */
-webkit-transition-property:width;
-webkit-transition-duration:10s;
div:hover
width:300px;
</style>
</head>
<body>
<div></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div.swapnil
width: 20px;
height: 20px;
width: 20px;
height: 20px;
color: #fff;
padding: 10px;
border-radius: 5px;
margin-left: 0;
-webkit-transition: 3s linear;
-moz-transition: 3s linear;
-o-transition: 3s linear;
-ms-transition: 3s linear;
transition: 3s linear;
width: 240px;
height: 220px;
-webkit-transform:rotate(360deg);
-moz-transform:rotate(360deg);
-o-transform:rotate(360deg);
-ms-transform:rotate(360deg);
transform:rotate(360deg);
</style>
</head>
<body>
<div class="raja">
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
#example
position:relative;
width:530px;
height:530px;
padding:10px;
}
.childbox
font-size:12px;
position:relative;
width:60px;
height:60px;
margin-bottom:10px;
background-color:#ccc;
.childbox p
text-align:center;
padding-top:10px;
#ease.childbox
#ease_in.childbox
#ease_out.childbox
#ease_in_out.childbox
#linear.childbox
#custom.childbox
#negative.childbox
#example:hover .childbox,
#example.hover_effect .childbox
{
-webkit-border-radius:30px;
-moz-border-radius:30px;
border-radius:30px;
-webkit-transform: rotate(720deg);
-moz-transform: rotate(720deg);
-o-transform: rotate(720deg);
-ms-transform: rotate(720deg);
transform: rotate(720deg);
margin-left:420px;
background-color:#fff;
</style>
</head>
<body>
<div id="example">
<div id="ease_in"
class="childbox"><p>CSS3</p></div>
<div id="ease_out"
class="childbox"><p>CSS3</p></div>
<div id="ease_in_out"
class="childbox"><p>CSS3</p></div>
<div id="linear"
class="childbox"><p>CSS3</p></div>
<div id="custom"
class="childbox"><p>CSS3</p></div>
<div id="negative"
class="childbox"><p>CSS3</p></div>
</div>
</body>
</html>
Borders:
A CSS3 Border is such an affords of style sheet which reduces the human efforts
of Photoshop and other graphical applications. An individual can create
the rounded borders, border shadow,imaged based border and etc.
• border-radius
• box-shadow
• border-image
<!DOCTYPE html>
<html>
<head>
<style>
div
padding:10px 40px;
background:gray;
width:300px;
border-radius:10px;
</style>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div
width:250px;
padding:10px 20px;
#round
border-image:url(b.png) 30 30 round;
#stretch
border-image:url(b.png) 30 30 stretch;
</style>
</head>
<body>
<br>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div
width:300px;
height:100px;
background-color:gray;
</style>
</head>
<body>
<div></div>
</body>
</html