SlideShare a Scribd company logo
CSS 3
Difference between CSS and CSS 3
 The CSS3 version supports many more browsers than CSS2, but be sure
to test it on all operating systems and browsers.
 Other major changes/additions include:
 * New Combinator
 * New CSS Selectors
 * New Pseudoelements
 * New Style properties
 Now let us discuss these in detail.
 Combinator New addition of General Sibling Combinator is done to
match sibling elements of a given element through tilde (~)
Combinator.
 CSS Selectors
 While CSS2 had ‘simple selectors’, the new version calls them the
components as ‘a sequence of simple selectors’.
 PseudoElements
 Many Pseudo Elements have been added that allow indepth yet
easy styling and a new convention of double colons ‘::’ has been
introduced.
 Style Properties
 New Background Style Properties Multiple Background images can
be layered in the box using different elements like background
image, position and repeat.
CSS3 Transitions
With CSS3, we can add an effect when changing from one style to
another, without using Flash or JavaScript.
CSS3 transitions are effects that let an element gradually change
from one style to another.
To do this, you must specify two things:
the CSS property you want to add an effect to
the duration of the effect
CSS3 Transitions
Example
Add a transition effect on the width property, with a duration of 2
seconds:
div {
‐webkit transition: width 2s; /* For Safari 3.1 to 6.0 */‐
transition: width 2s;
}
div:hover{
width : 300px;
}
 Example
 Add transition effects on width, height, and transformation:
div {
‐webkit transition: width 2s, height 2s, webkit transform 2s;‐ ‐ ‐
/* For Safari 3.1 to 6.0 */
transition: width 2s, height 2s, transform 2s;
}
CSS3 Animations
 CSS3 animations can replace animations created by Flash and
JavaScript in existing web pages.
 Numbers followed by webkit, moz, or ospecify the first version that
worked with a prefix.
 CSS3 @keyframes Rule
 The @keyframes rule is where the animation is created.
 Specify a CSS style inside the @keyframes rule and the animation
will gradually
 change from the current style to the new style.
 When an animation is created in the @keyframe rule, you must bind
it to a selector, otherwise the animation will have no effect.
 Bind the animation to a selector (element) by specifying at least
these two properties:
 the name of the animation
 the duration of the animation
 Example :
 Bind the "myfirst" animation to the <div> element. Animation duration: 5 seconds:
div {
‐webkit animation: myfirst 5s; /* Chrome, Safari, Opera */‐
animation: myfirst 5s;
}
/* Chrome, Safari, Opera */
@ webkit keyframes myfirst {‐ ‐
from {background: red;}
to {background: yellow;}
}
/* Standard syntax */
@keyframes myfirst {
from {background: red;}
to {background: yellow;}
}
Gradients Background
 CSS3 gradients let you display smooth transitions between two or
more specified colors.
 Earlier, you had to use images for these effects. However, by using
CSS3 gradients you can reduce download time and bandwidth
usage. In addition, elements with gradients look better when
zoomed, because the gradient is generated by the browser.
 CSS3 defines two types of gradients:
 Linear Gradients (goes down/up/left/right/diagonally)
 Radial Gradients (defined by their center)
CSS3 Linear Gradients
 To create a linear gradient you must define at least two color stops.
Color stops are the colors you want to render smooth transitions
among. You can also set a starting point and a direction (or an
angle) along with the gradient effect.
 Syntax :
background: linear gradient(‐ direction, color stop1‐ , color stop2, ...‐ );
 Linear Gradient Top to Bottom (this is default)
 Example
A linear gradient from top to bottom:
#grad {
background: webkit linear gradient(red, blue); /* For Safari 5.1 to‐ ‐ ‐ 6.0
*/
background: o linear gradient(red, blue); /* For Opera 11.1 to 12.0‐ ‐ ‐ */
background: moz linear gradient(red, blue); /* For Firefox 3.6 to 15‐ ‐ ‐ */
background: linear gradient(red, blue); /* Standard syntax */‐
}
 Linear Gradient Diagonal
 You can make a gradient diagonally by specifying both the horizontal and vertical
starting positions.
Example :
A linear gradient that starts at top left (and goes to bottom right):
#grad {
background: webkit linear gradient(left top, red , blue); /* For‐ ‐ ‐ Safari 5.1 to 6.0 */
background: o linear gradient(bottom right, red, blue); /* For Opera‐ ‐ ‐ 11.1 to 12.0 */
background: moz linear gradient(bottom right, red, blue); /* For‐ ‐ ‐ Firefox 3.6 to 15 */
background: linear gradient(to bottom right, red , blue); /* Standard‐ syntax */
}
CSS3 Radial Gradients
 A radial gradient is defined by its center.
 To create a radial gradient you must also define at least two color
stops.
 Syntax
 background: radial gradient(‐ shape size at position, start color, ...,‐
lastcolor);
 Radial Gradient Evenly Spaced Color Stops (this is default)
 Example
 A radial gradient with evenly spaced color stops:
#grad {
background: webkit radial gradient(red, green, blue); /* Safari 5.1‐ ‐ ‐ to 6.0 */
background: o radial gradient(red, green, blue); /* For Opera 11.6 to‐ ‐ ‐ 12.0 */
background: moz radial gradient(red, green, blue); /* For Firefox 3.6‐ ‐ ‐ to 15 */
background: radial gradient(red, green, blue); /* Standard syntax */‐
}
 Set Shape
 The shape parameter defines the shape. It can take the value circle or ellipse.
The default value is ellipse.
 Example
A radial gradient with the shape of a circle:
#grad {
background: webkit radial gradient(circle, red, yellow, green); /*‐ ‐ ‐ Safari */
background: o radial gradient(circle, red, yellow, green); /* Opera‐ ‐ ‐ 11.6 to 12.0 */
background: moz radial gradient(circle, red, yellow, green); /*‐ ‐ ‐ Firefox 3.6 to 15 */
background: radial gradient(circle, red, yellow, green); /* Standard‐ syntax */
}
 Repeating a radialgradient
 The repeatingradialgradient() function is used to repeat radial gradients:
 Example
 A repeating radial gradient:
#grad {
/* For Safari 5.1 to 6.0 */
background: webkit repeating radial gradient(red, yellow 10%, green‐ ‐ ‐ ‐ 15%);
/* For Opera 11.6 to 12.0 */
background: o repeating radial gradient(red, yellow 10%, green 15%);‐ ‐ ‐ ‐
/* For Firefox 3.6 to 15 */
background: moz repeating radial gradient(red, yellow 10%, green‐ ‐ ‐ ‐ 15%);
/* Standard syntax */
background: repeating radial gradient(red, yellow 10%, green 15%);‐ ‐
}

More Related Content

PPTX
CSS Transitions, Transforms, Animations
PDF
CSS3 Transforms Transitions and Animations
PDF
Creating Beautiful CSS3 Animations - FITC Amsterdam 2016
PPTX
Css animation
PDF
Mastering CSS Animations
PDF
Dynamic CSS: Transforms, Transitions, and Animation Basics
PPTX
CSS3 2D/3D transform
PPTX
CSS3 For WebKit: iPadDevCamp Presentation
CSS Transitions, Transforms, Animations
CSS3 Transforms Transitions and Animations
Creating Beautiful CSS3 Animations - FITC Amsterdam 2016
Css animation
Mastering CSS Animations
Dynamic CSS: Transforms, Transitions, and Animation Basics
CSS3 2D/3D transform
CSS3 For WebKit: iPadDevCamp Presentation

What's hot (19)

PPTX
CSS3 Implementable Features
PDF
I Can't Believe It's Not Flash
PPTX
Open Web Camp: CSS3 Implementable Features
PPT
PDF
Interface Styling & Scripting on WebKit Mobile
PDF
Exploring fractals in CSS, @fronttrends, Warsaw, 2015
PDF
Documento de acrobat2
DOC
Seg code
PDF
Breaking Free from Bootstrap: Custom Responsive Grids with Sass Susy
PDF
Implementation of c string functions
PDF
Fasten RWD Development with Sass
PDF
React & Radium (Colin Megill)
PDF
Processing資料(8) 文字
PDF
Adaptive theming using compass susy grid
PPTX
Introduction to open gl in android droidcon - slides
PDF
Vim cheat-sheet-en
PDF
Simplify your CSS with Stylus and Nib
KEY
Interactive Graphics
CSS3 Implementable Features
I Can't Believe It's Not Flash
Open Web Camp: CSS3 Implementable Features
Interface Styling & Scripting on WebKit Mobile
Exploring fractals in CSS, @fronttrends, Warsaw, 2015
Documento de acrobat2
Seg code
Breaking Free from Bootstrap: Custom Responsive Grids with Sass Susy
Implementation of c string functions
Fasten RWD Development with Sass
React & Radium (Colin Megill)
Processing資料(8) 文字
Adaptive theming using compass susy grid
Introduction to open gl in android droidcon - slides
Vim cheat-sheet-en
Simplify your CSS with Stylus and Nib
Interactive Graphics
Ad

Viewers also liked (10)

PDF
Workshop Advance CSS3 animation
PPTX
Css3 animation
KEY
Better CSS with Compass/Sass
PPTX
Sass: Introduction
PDF
LESS, SASS, HAML: 4 буквы, изменившие frontend development
PDF
High Performance JavaScript - WebDirections USA 2010
KEY
Sass: The Future of Stylesheets
PDF
Sass and compass workshop
PPT
JavaScript and DOM Pattern Implementation
PPTX
CSS3
Workshop Advance CSS3 animation
Css3 animation
Better CSS with Compass/Sass
Sass: Introduction
LESS, SASS, HAML: 4 буквы, изменившие frontend development
High Performance JavaScript - WebDirections USA 2010
Sass: The Future of Stylesheets
Sass and compass workshop
JavaScript and DOM Pattern Implementation
CSS3
Ad

Similar to CSS3 : Animation ,Transitions, Gradients (20)

PPTX
Css gradients
PPTX
css trasition explanation about our project
PPTX
Cordova training - Day 3 : Advanced CSS 3
PDF
CSS Less framework overview, Pros and Cons
PDF
Accelerated Stylesheets
PDF
Class 4 handout w css3 using j fiddle
PDF
Css3 transitions and animations + graceful degradation with jQuery
PDF
LESS : The dynamic stylesheet language
PPTX
PDF
Preprocessor presentation
PPTX
Write LESS. DO more.
PDF
@Agawish creating a stunning ui with oracle adf faces, using sass
PPT
UNIT 3.ppt
PDF
Dallas Drupal Days 2012 - Introduction to less sass-compass
 
ODP
Css3 101
PDF
CSS Extenders
PPT
POLITEKNIK MALAYSIA
PDF
HTML5 e Css3 - 4 | WebMaster & WebDesigner
Css gradients
css trasition explanation about our project
Cordova training - Day 3 : Advanced CSS 3
CSS Less framework overview, Pros and Cons
Accelerated Stylesheets
Class 4 handout w css3 using j fiddle
Css3 transitions and animations + graceful degradation with jQuery
LESS : The dynamic stylesheet language
Preprocessor presentation
Write LESS. DO more.
@Agawish creating a stunning ui with oracle adf faces, using sass
UNIT 3.ppt
Dallas Drupal Days 2012 - Introduction to less sass-compass
 
Css3 101
CSS Extenders
POLITEKNIK MALAYSIA
HTML5 e Css3 - 4 | WebMaster & WebDesigner

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Cloud computing and distributed systems.
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Machine learning based COVID-19 study performance prediction
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
cuic standard and advanced reporting.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
Electronic commerce courselecture one. Pdf
Big Data Technologies - Introduction.pptx
Understanding_Digital_Forensics_Presentation.pptx
Review of recent advances in non-invasive hemoglobin estimation
Unlocking AI with Model Context Protocol (MCP)
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Cloud computing and distributed systems.
sap open course for s4hana steps from ECC to s4
Machine learning based COVID-19 study performance prediction
“AI and Expert System Decision Support & Business Intelligence Systems”
cuic standard and advanced reporting.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Programs and apps: productivity, graphics, security and other tools
Advanced methodologies resolving dimensionality complications for autism neur...
Chapter 3 Spatial Domain Image Processing.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Per capita expenditure prediction using model stacking based on satellite ima...

CSS3 : Animation ,Transitions, Gradients

  • 2. Difference between CSS and CSS 3  The CSS3 version supports many more browsers than CSS2, but be sure to test it on all operating systems and browsers.  Other major changes/additions include:  * New Combinator  * New CSS Selectors  * New Pseudoelements  * New Style properties
  • 3.  Now let us discuss these in detail.  Combinator New addition of General Sibling Combinator is done to match sibling elements of a given element through tilde (~) Combinator.  CSS Selectors  While CSS2 had ‘simple selectors’, the new version calls them the components as ‘a sequence of simple selectors’.
  • 4.  PseudoElements  Many Pseudo Elements have been added that allow indepth yet easy styling and a new convention of double colons ‘::’ has been introduced.  Style Properties  New Background Style Properties Multiple Background images can be layered in the box using different elements like background image, position and repeat.
  • 5. CSS3 Transitions With CSS3, we can add an effect when changing from one style to another, without using Flash or JavaScript. CSS3 transitions are effects that let an element gradually change from one style to another. To do this, you must specify two things: the CSS property you want to add an effect to the duration of the effect
  • 6. CSS3 Transitions Example Add a transition effect on the width property, with a duration of 2 seconds: div { ‐webkit transition: width 2s; /* For Safari 3.1 to 6.0 */‐ transition: width 2s; } div:hover{ width : 300px; }
  • 7.  Example  Add transition effects on width, height, and transformation: div { ‐webkit transition: width 2s, height 2s, webkit transform 2s;‐ ‐ ‐ /* For Safari 3.1 to 6.0 */ transition: width 2s, height 2s, transform 2s; }
  • 8. CSS3 Animations  CSS3 animations can replace animations created by Flash and JavaScript in existing web pages.  Numbers followed by webkit, moz, or ospecify the first version that worked with a prefix.  CSS3 @keyframes Rule  The @keyframes rule is where the animation is created.  Specify a CSS style inside the @keyframes rule and the animation will gradually  change from the current style to the new style.
  • 9.  When an animation is created in the @keyframe rule, you must bind it to a selector, otherwise the animation will have no effect.  Bind the animation to a selector (element) by specifying at least these two properties:  the name of the animation  the duration of the animation
  • 10.  Example :  Bind the "myfirst" animation to the <div> element. Animation duration: 5 seconds: div { ‐webkit animation: myfirst 5s; /* Chrome, Safari, Opera */‐ animation: myfirst 5s; } /* Chrome, Safari, Opera */ @ webkit keyframes myfirst {‐ ‐ from {background: red;} to {background: yellow;} } /* Standard syntax */ @keyframes myfirst { from {background: red;} to {background: yellow;} }
  • 11. Gradients Background  CSS3 gradients let you display smooth transitions between two or more specified colors.  Earlier, you had to use images for these effects. However, by using CSS3 gradients you can reduce download time and bandwidth usage. In addition, elements with gradients look better when zoomed, because the gradient is generated by the browser.  CSS3 defines two types of gradients:  Linear Gradients (goes down/up/left/right/diagonally)  Radial Gradients (defined by their center)
  • 12. CSS3 Linear Gradients  To create a linear gradient you must define at least two color stops. Color stops are the colors you want to render smooth transitions among. You can also set a starting point and a direction (or an angle) along with the gradient effect.  Syntax : background: linear gradient(‐ direction, color stop1‐ , color stop2, ...‐ );
  • 13.  Linear Gradient Top to Bottom (this is default)  Example A linear gradient from top to bottom: #grad { background: webkit linear gradient(red, blue); /* For Safari 5.1 to‐ ‐ ‐ 6.0 */ background: o linear gradient(red, blue); /* For Opera 11.1 to 12.0‐ ‐ ‐ */ background: moz linear gradient(red, blue); /* For Firefox 3.6 to 15‐ ‐ ‐ */ background: linear gradient(red, blue); /* Standard syntax */‐ }
  • 14.  Linear Gradient Diagonal  You can make a gradient diagonally by specifying both the horizontal and vertical starting positions. Example : A linear gradient that starts at top left (and goes to bottom right): #grad { background: webkit linear gradient(left top, red , blue); /* For‐ ‐ ‐ Safari 5.1 to 6.0 */ background: o linear gradient(bottom right, red, blue); /* For Opera‐ ‐ ‐ 11.1 to 12.0 */ background: moz linear gradient(bottom right, red, blue); /* For‐ ‐ ‐ Firefox 3.6 to 15 */ background: linear gradient(to bottom right, red , blue); /* Standard‐ syntax */ }
  • 15. CSS3 Radial Gradients  A radial gradient is defined by its center.  To create a radial gradient you must also define at least two color stops.  Syntax  background: radial gradient(‐ shape size at position, start color, ...,‐ lastcolor);
  • 16.  Radial Gradient Evenly Spaced Color Stops (this is default)  Example  A radial gradient with evenly spaced color stops: #grad { background: webkit radial gradient(red, green, blue); /* Safari 5.1‐ ‐ ‐ to 6.0 */ background: o radial gradient(red, green, blue); /* For Opera 11.6 to‐ ‐ ‐ 12.0 */ background: moz radial gradient(red, green, blue); /* For Firefox 3.6‐ ‐ ‐ to 15 */ background: radial gradient(red, green, blue); /* Standard syntax */‐ }
  • 17.  Set Shape  The shape parameter defines the shape. It can take the value circle or ellipse. The default value is ellipse.  Example A radial gradient with the shape of a circle: #grad { background: webkit radial gradient(circle, red, yellow, green); /*‐ ‐ ‐ Safari */ background: o radial gradient(circle, red, yellow, green); /* Opera‐ ‐ ‐ 11.6 to 12.0 */ background: moz radial gradient(circle, red, yellow, green); /*‐ ‐ ‐ Firefox 3.6 to 15 */ background: radial gradient(circle, red, yellow, green); /* Standard‐ syntax */ }
  • 18.  Repeating a radialgradient  The repeatingradialgradient() function is used to repeat radial gradients:  Example  A repeating radial gradient: #grad { /* For Safari 5.1 to 6.0 */ background: webkit repeating radial gradient(red, yellow 10%, green‐ ‐ ‐ ‐ 15%); /* For Opera 11.6 to 12.0 */ background: o repeating radial gradient(red, yellow 10%, green 15%);‐ ‐ ‐ ‐ /* For Firefox 3.6 to 15 */ background: moz repeating radial gradient(red, yellow 10%, green‐ ‐ ‐ ‐ 15%); /* Standard syntax */ background: repeating radial gradient(red, yellow 10%, green 15%);‐ ‐ }