SlideShare a Scribd company logo
CSS 3 – Overview
                                What is new in CSS 3?


Nikolay Kostov
Technical Trainer
http://nikolay.it
Telerik Software Academy
academy.telerik.com
Table of Contents
1.   What is CSS 3?
2.   Selectors
3.   Fonts
4.   Colors
5.   Backgrounds
6.   Borders
7.   Box Model
8.   Animations

                                          2
What is CSS 3?
What is CSS 3?
 Cascading Style Sheets level 3 is the most
 recent iteration of CSS
 It is divided into several separate
 documents called "modules"
 CSS 3 has not been approved as a
 specification, but there are already a lot of
 properties that are supported in various
 browsers.
 The earliest CSS 3 drafts were published in
 June 1999
                                                 4
Selectors
Attribute Selectors
 E[foo^="bar"]

  An E element whose "foo" attribute value
   begins exactly with the string "bar"
  Example: a[src^="https://"]
 E[foo$="bar"]

  An E element whose "foo" attribute value ends
   exactly with the string "bar"
 E[foo*="bar"]

  An E element whose "foo" attribute value
   contains the substring "bar"
                                                   6
Attribute Selectors
      Live Demo
Structural Pseudo-classes
 :root

  The root of the document
 E:nth-child(n)

  An E element, the n-th child of its parent
 E:nth-last-child(n)

  An E element, the n-th child of its parent,
   counting from the last on
 E:nth-of-type(n)

  An E element, the n-th sibling of its type
                                                 8
Structural Pseudo-classes (2)
 E:nth-last-of-type(n)

  An E element, the n-th sibling of its type,
   counting from the last one
 E:last-child

  An E element, last child of its parent
 E:first-of-type

  An E element, first sibling of its type
 E:last-of-type

  An E element, last sibling of its type
                                                 9
Structural Pseudo-classes (3)
 E:only-child

   An E element, only child of its parent
 E:only-of-type

   An E element, only sibling of its type
 E:empty

   An E element that has no children (including
    text nodes)
 More detailed descriptions:

http://www.w3.org/TR/css3-selectors/#structural-pseudos
                                                          10
Structural Selectors
      Live Demo
The UI Element States
                            Pseudo-classes
 E:enabled

  A user interface element E which is enabled
 E:disabled

  A user interface element E which is disabled
 E:checked

  A user interface element E which is checked (for
   instance a radio-button or checkbox)
  Currently supported only in Opera!
                                                      12
UI Selectors
  Live Demo
Other CSS 3 Selectors
 E:target

  An E element being the target of the referring
   URI
 E:not(s)

  An E element that does not match simple
   selector
E   ~ F
  An F element preceded by an E element


                                                    14
Other CSS 3 Selectors
       Live Demo
Fonts
Font Embeds
   Use @font-face to declare font
   Point to font file on server
   Call font with font-family
   Currently not supported in IE
   Use font embedding instead of images
    @font-face {
           font-family: SketchRockwell;
           src: url('SketchRockwell-Bold.ttf');
    }
    .my_CSS3_class {
           font-family: SketchRockwell;
           font-size: 3.2em;                        17
    }
Text Shadow
 Applies shadow to text
 Syntax: text-shadow: <horizontal-
    distance> <vertical-distance>
    <blur-radius> <shadow-color>;
   Do not alter the size of a box



    text-shadow: 2px 2px 7px #000000;


                                                  18
Text Overflow
 Specifies what should happen when text
 overflows the containing element
 Syntax:   text-overflow: <value>;
 Possible values:

   ellipsis - Display ellipses to represent clipped
    text
   clip - Default value, clips text


 Currently not supported in Firefox and IE

                                                       19
Word Wrapping
 Allows long words to be able to be broken and
 wrap onto the next line
 Syntax:   word-wrap: <value>;
 Possible values:

   normal


   break-word


 Supported in all major browsers

                                                  20
CSS 3 Fonts
  Live Demo
Colors
Opacity
 Sets the opacity level for an element

 Syntax:    opacity: <value>;
 Value from 0.0 (fully transparent) to 1.0

 The opacity is supported in all major browsers.

 Note: IE8 and earlier supports an alternative,
    the filter property: filter: Alpha(opacity=50).
   Example:
               <img src="img.jpg" style= "
               opacity: 0.4;
               filter: alpha(opacity=40)" />
                                                      23
RGBA Colors
 Standard RGB colors with an opacity value for
 the color (alpha channel)
 Syntax:
        rgba(<red>, <green>,
 <blue>, <alpha>)
 The range for red, green and blue is between
 integers 0 and 255
 The range for the alpha channel is between 0.0
 and 1.0
 Example: rgba(255,   0, 0, 0.5)

                                                  24
HSL Colors
 Hue is a degree on the color wheel

   0 (or 360) is red, 120 is green, 240 is blue
 Saturation is a percentage value

   100% is the full color
 Lightness is also a percentage

   0% is dark (black)
   100% is light (white)
   50% is the average

                                                    25
HSLA Colors
 HSLA allows a fourth value, which sets the

 Opacity (via the Alpha channel) of the element.
 As RGBA is to RGB, HSLA is to HSL

 Supported in IE9+, Firefox 3+, Chrome, Safari,

 and in Opera 10+
 Example:

   hsla(0, 100%, 50%, 0.5)
   Result:

                                                   26
CSS 3 Colors
  Live Demo
Backgrounds
Gradient Backgrounds
 Gradients are smooth transitions between two

 or more specified colors
 Use of CSS gradients can replace images and

 reduce download time
 Create a more flexible layout, and look better

 while zooming
 Supported in all major browsers via different

 keywords
 This is still an experimental feature

                                                   29
Gradient Backgrounds Example
/* Firefox 3.6+ */
background: -moz-linear-gradient(100% 100% 90deg,
  #FFFF00, #0000FF);
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, 0% 0%, 0%
  100%, from(#0000FF), to(#FFFF00));
/* Safari 5.1+, Chrome 10+ */
background: -webkit-linear-gradient(#FFFF00,
  #0000FF);
/* Opera 11.10+ */
background: -o-linear-gradient(#2F2727, #0000FF);




                                                    30
Multiple Backgrounds
 CSS3 allows multiple background images

 Simple comma-separated list of images

 Supported in Firefox (3.6+), Chrome (1.0/1.3+),

 Opera (10.5+) and Internet Explorer (9.0+)
 Comma separated list for the other properties

background-image: url(sheep.png), url(grass.png);




                                                    31
Backgrounds
  Live Demo
Borders
Border color
 Allows you to create cool colored borders

 Only Firefox supports this type of coloring

border: 8px solid #000;
-moz-border-bottom-colors: #555 #666 #777 #888
#999 #aaa #bbb #ccc;
-moz-border-top-colors: #555 #666 #777 #888 #999
#aaa #bbb #ccc;
-moz-border-left-colors: #555 #666 #777 #888 #999
#aaa #bbb #ccc;
-moz-border-right-colors: #555 #666 #777 #888
#999 #aaa #bbb #ccc;


                                                    34
Border radius
 Allows web developers to easily utilize rounder
 corners in their design elements
 Widespread browser support

 Syntax:

border-*-*-radius: [<length>|<%>][<length>|<%>]?
 Example:

-moz-border-radius: 15px;
border-radius: 15px;
background-color: #FF00FF;


                                                    35
Box shadow
 Allows to easily implement multiple drop

 shadows (outer or inner) on box elements
 Specifying values for color, size, blur and offset

 Example:

-moz-box-shadow: 10px 10px 5px #888;
-webkit-box-shadow: 10px 10px 5px #888;
box-shadow: 10px 10px 5px #888;




                                                       36
Borders
Live Demo
Box Model
CSS3 box-sizing
 Determine whether you want an element to

 render it's borders and padding within its
 specified width, or outside of it.
 Possible values:

   box-sizing: content-box (default)
    box width: 288 pixels + 10 pixels padding and 1
    pixel border on each side = 300 pixels
   box-sizing: border-box
    box width: 300 pixels, including padding and
    borders
                                                      39
CSS3 box-sizing (Example)
 Example: Box with total width of 300 px

 (including paddings and borders)
  width: 300px;
  border: 1px solid black;
  padding: 5px;

  /* Firefox */
  -moz-box-sizing: border-box;
  /* WebKit */
  -webkit-box-sizing: border-box;
  /* Opera 9.5+, Google Chrome */
  box-sizing: border-box;

                                            40
CSS 3 Flexible Box Model
 The flexible box model determines the way

 boxes are distributed inside other boxes and
 the way they share the available space.
 New values for "display" property:

   flexbox
   inline-flexbox
 This box model is still under development

 Still not supported in major browsers


                                                41
CSS 3 Box Model Properties
 flex-direction

   Specifies how flexbox items are placed
 flex-order

   May be used to change the ordering of the
    elements. Elements are sorted by this value.
 flex-pack

   Defines the flexibility of packing spaces
 flex-align

   Changes the way free space is allocated
                                                   42
CSS 3 flex-direction
 The flex-direction property specifies how

 flexbox items are placed in the flexbox.
 Possible values:

   lr – Displays elements from left to right
   rl – Displays elements from right to left
   tb – Displays elements from top to bottom
   bt – Displays elements from bottom to top
   inline and inline-reverse
   block and block-reverse
                                                43
Box Model
 Live Demo
Animations
Animations
 Works in all webkit browsers

 Example:

  @keyframes resize {
        0% {...}
        50% {...}
        100% {...}
  }
  #box {
        animation-name: resize;
        animation-duration: 1s;
        animation-iteration-count: 4;
        animation-direction: alternate;
  animation-timing-function: ease-in-out;
  }
                                              46
Transitions
 Add an effect when changing from one style to
 another
 Different timing functions:

   ease, ease-in, ease-out, ease-in-out, linear
 Example:

  #id_of_element {
       -webkit-transition: all 1s ease-in-out;
       -moz-transition: all 1s ease-in-out;
       -o-transition: all 1s ease-in-out;
       -ms-transition: all 1s ease-in-out;
  transition: all 1s ease-in-out;
  }
                                                   47
2D Transformations
 2D transforms are widely supported

 Skew – skew element

   transform: skew(35deg);
 Scale – scale element

   transform: scale(1,0.5);
 Rotate – rotates element

   transform: rotate(45deg);
 Translate – moves element

   transform: translate(10px, 20px);
                                           48
3D Transformations
 3D transforms are similar to 2D transforms

 Only work in Safari and Chrome

 X, Y and Z transformation

   transform: rotateX(180deg);
   transform: rotateY(180deg);
   transform: rotateZ(180deg);
   perspective: 800;
   perspective-origin: 50% 100px;
   translate3d, scale3d
                                               49
Animations
  Live Demo
CSS 3




http://html5course.telerik.com
Exercises
1.   Using your knowledge of CSS 3 style, the given
     HTML code and approximate the end result (shown
     in the image below:
     <div id="example_form">
       <h1>Example form</h1>
       Your name:
       <input value="Mark DuBois"/>
       Your email:
       <input value="Mark@...." />
       <input value="Subscribe"
          type="submit" />
     </div>

                                                       52
Exercises (2)
1.    Using CSS3 make a rotating 3D
      Rubik Cube.
2.    Using CSS3 make a text that is
      pulsing, i.e. gets bigger, then smaller, etc. while
      blinking with different colors.
3.    Using CSS3 make a text bouncing around the screen
      (the browser).
      Hint: the text should change its position



                                                            53
Exercises (3)
1.   Using CSS3 make a landscape with a lake/sea with ships
     moving in it.




                                                              54

More Related Content

What's hot

Dynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship groupDynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship group
Reuven Lerner
 
Working with color and font
Working with color and fontWorking with color and font
Working with color and fontmyrajendra
 
Css3
Css3Css3
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
Swapnali Pawar
 

What's hot (6)

Dynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship groupDynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship group
 
Working with color and font
Working with color and fontWorking with color and font
Working with color and font
 
Css3
Css3Css3
Css3
 
Unix commands
Unix commandsUnix commands
Unix commands
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
 
Sass, Compass
Sass, CompassSass, Compass
Sass, Compass
 

Viewers also liked

WPF Templating and Styling
WPF Templating and StylingWPF Templating and Styling
WPF Templating and StylingDoncho Minkov
 
Complex Data Binding
Complex Data BindingComplex Data Binding
Complex Data BindingDoncho Minkov
 
Data Access with ADO.Net
Data Access with ADO.NetData Access with ADO.Net
Data Access with ADO.Net
Amitek Rathod
 
Model View ViewModel
Model View ViewModelModel View ViewModel
Model View ViewModelDoncho Minkov
 
Ado.net
Ado.netAdo.net
Ado.net
dina1985vlr
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
Randy Connolly
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
Snehal Harawande
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
Anekwong Yoddumnern
 

Viewers also liked (17)

WPF Controls
WPF ControlsWPF Controls
WPF Controls
 
WPF Templating and Styling
WPF Templating and StylingWPF Templating and Styling
WPF Templating and Styling
 
CSS Presentation
CSS PresentationCSS Presentation
CSS Presentation
 
Complex Data Binding
Complex Data BindingComplex Data Binding
Complex Data Binding
 
Data Access with ADO.Net
Data Access with ADO.NetData Access with ADO.Net
Data Access with ADO.Net
 
Slice and Dice
Slice and DiceSlice and Dice
Slice and Dice
 
WPF and Databases
WPF and DatabasesWPF and Databases
WPF and Databases
 
Web Design Concepts
Web Design ConceptsWeb Design Concepts
Web Design Concepts
 
Model View ViewModel
Model View ViewModelModel View ViewModel
Model View ViewModel
 
Web design Tools
Web design ToolsWeb design Tools
Web design Tools
 
WPF Concepts
WPF ConceptsWPF Concepts
WPF Concepts
 
Simple Data Binding
Simple Data BindingSimple Data Binding
Simple Data Binding
 
Ado.net
Ado.netAdo.net
Ado.net
 
HTML 5
HTML 5HTML 5
HTML 5
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
 

Similar to CSS 3

Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.
Eugene Nor
 
HTML5: The Future of Web Development with IE9, IE10 and Windows 8
HTML5: The Future of Web Development with IE9, IE10 and Windows 8HTML5: The Future of Web Development with IE9, IE10 and Windows 8
HTML5: The Future of Web Development with IE9, IE10 and Windows 8
Shaymaa
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
Achmad Solichin
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3 Wynn Netherland
 
Advanced CSS Tricks and Techniques
Advanced CSS Tricks and TechniquesAdvanced CSS Tricks and Techniques
Advanced CSS Tricks and Techniques
Robert Richelieu
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and Backgrounds
Steve Guinan
 
CSS: The Boring Bits
CSS: The Boring BitsCSS: The Boring Bits
CSS: The Boring Bits
Peter Gasston
 
Css3 shubelal
Css3   shubelalCss3   shubelal
Css3 shubelal
Shub
 
CSS-3 Course Slide
CSS-3 Course SlideCSS-3 Course Slide
CSS-3 Course Slide
BoneyGawande
 
DV10 HTML5: The Future of Web Development
DV10 HTML5: The Future of Web Development DV10 HTML5: The Future of Web Development
DV10 HTML5: The Future of Web Development
Ronald Widha
 
Introduction to the Roku SDK
Introduction to the Roku SDKIntroduction to the Roku SDK
Introduction to the Roku SDK
Chris Adamson
 
Formatting text with CSS
Formatting text with CSSFormatting text with CSS
Formatting text with CSS
Nicole Ryan
 
WEB PROGRAMMING
WEB PROGRAMMINGWEB PROGRAMMING
WEB PROGRAMMING
sweetysweety8
 
Lab#9 graphic and color
Lab#9 graphic and colorLab#9 graphic and color
Lab#9 graphic and color
Yaowaluck Promdee
 
Concept of CSS part 2
Concept of CSS part 2Concept of CSS part 2
Concept of CSS part 2
SURBHI SAROHA
 

Similar to CSS 3 (20)

CSS3
CSS3CSS3
CSS3
 
Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.
 
HTML5: The Future of Web Development with IE9, IE10 and Windows 8
HTML5: The Future of Web Development with IE9, IE10 and Windows 8HTML5: The Future of Web Development with IE9, IE10 and Windows 8
HTML5: The Future of Web Development with IE9, IE10 and Windows 8
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3
 
Advanced CSS Tricks and Techniques
Advanced CSS Tricks and TechniquesAdvanced CSS Tricks and Techniques
Advanced CSS Tricks and Techniques
 
Css 3 overview
Css 3 overviewCss 3 overview
Css 3 overview
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and Backgrounds
 
CSS: The Boring Bits
CSS: The Boring BitsCSS: The Boring Bits
CSS: The Boring Bits
 
CSS and CSS3
CSS and CSS3CSS and CSS3
CSS and CSS3
 
Css3 shubelal
Css3   shubelalCss3   shubelal
Css3 shubelal
 
CSS-3 Course Slide
CSS-3 Course SlideCSS-3 Course Slide
CSS-3 Course Slide
 
DV10 HTML5: The Future of Web Development
DV10 HTML5: The Future of Web Development DV10 HTML5: The Future of Web Development
DV10 HTML5: The Future of Web Development
 
Introduction to the Roku SDK
Introduction to the Roku SDKIntroduction to the Roku SDK
Introduction to the Roku SDK
 
Formatting text with CSS
Formatting text with CSSFormatting text with CSS
Formatting text with CSS
 
WEB PROGRAMMING
WEB PROGRAMMINGWEB PROGRAMMING
WEB PROGRAMMING
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Hardcore CSS
Hardcore CSSHardcore CSS
Hardcore CSS
 
Lab#9 graphic and color
Lab#9 graphic and colorLab#9 graphic and color
Lab#9 graphic and color
 
Concept of CSS part 2
Concept of CSS part 2Concept of CSS part 2
Concept of CSS part 2
 

More from Doncho Minkov

HTML 5 Tables and Forms
HTML 5 Tables and FormsHTML 5 Tables and Forms
HTML 5 Tables and FormsDoncho Minkov
 
Introduction to XAML and WPF
Introduction to XAML and WPFIntroduction to XAML and WPF
Introduction to XAML and WPFDoncho Minkov
 
WPF Layout Containers
WPF Layout ContainersWPF Layout Containers
WPF Layout ContainersDoncho Minkov
 
WPF Graphics and Animations
WPF Graphics and AnimationsWPF Graphics and Animations
WPF Graphics and AnimationsDoncho Minkov
 
Introduction to Cross-platform Mobile Development Course
Introduction to Cross-platform Mobile Development CourseIntroduction to Cross-platform Mobile Development Course
Introduction to Cross-platform Mobile Development CourseDoncho Minkov
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTMLDoncho Minkov
 

More from Doncho Minkov (17)

HTML 5 Tables and Forms
HTML 5 Tables and FormsHTML 5 Tables and Forms
HTML 5 Tables and Forms
 
CSS Overview
CSS OverviewCSS Overview
CSS Overview
 
CSS Layout
CSS LayoutCSS Layout
CSS Layout
 
Adobe Photoshop
Adobe PhotoshopAdobe Photoshop
Adobe Photoshop
 
Introduction to XAML and WPF
Introduction to XAML and WPFIntroduction to XAML and WPF
Introduction to XAML and WPF
 
WPF Layout Containers
WPF Layout ContainersWPF Layout Containers
WPF Layout Containers
 
WPF Graphics and Animations
WPF Graphics and AnimationsWPF Graphics and Animations
WPF Graphics and Animations
 
Introduction to Cross-platform Mobile Development Course
Introduction to Cross-platform Mobile Development CourseIntroduction to Cross-platform Mobile Development Course
Introduction to Cross-platform Mobile Development Course
 
HTML Fundamentals
HTML FundamentalsHTML Fundamentals
HTML Fundamentals
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
HTML5
HTML5HTML5
HTML5
 
CSS Part I
CSS Part ICSS Part I
CSS Part I
 
CSS Part II
CSS Part IICSS Part II
CSS Part II
 
Workshop Usability
Workshop UsabilityWorkshop Usability
Workshop Usability
 
JavaScript
JavaScriptJavaScript
JavaScript
 
JavaScript OOP
JavaScript OOPJavaScript OOP
JavaScript OOP
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 

Recently uploaded

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 

Recently uploaded (20)

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 

CSS 3

  • 1. CSS 3 – Overview What is new in CSS 3? Nikolay Kostov Technical Trainer http://nikolay.it Telerik Software Academy academy.telerik.com
  • 2. Table of Contents 1. What is CSS 3? 2. Selectors 3. Fonts 4. Colors 5. Backgrounds 6. Borders 7. Box Model 8. Animations 2
  • 4. What is CSS 3?  Cascading Style Sheets level 3 is the most recent iteration of CSS  It is divided into several separate documents called "modules"  CSS 3 has not been approved as a specification, but there are already a lot of properties that are supported in various browsers.  The earliest CSS 3 drafts were published in June 1999 4
  • 6. Attribute Selectors  E[foo^="bar"]  An E element whose "foo" attribute value begins exactly with the string "bar"  Example: a[src^="https://"]  E[foo$="bar"]  An E element whose "foo" attribute value ends exactly with the string "bar"  E[foo*="bar"]  An E element whose "foo" attribute value contains the substring "bar" 6
  • 8. Structural Pseudo-classes  :root  The root of the document  E:nth-child(n)  An E element, the n-th child of its parent  E:nth-last-child(n)  An E element, the n-th child of its parent, counting from the last on  E:nth-of-type(n)  An E element, the n-th sibling of its type 8
  • 9. Structural Pseudo-classes (2)  E:nth-last-of-type(n)  An E element, the n-th sibling of its type, counting from the last one  E:last-child  An E element, last child of its parent  E:first-of-type  An E element, first sibling of its type  E:last-of-type  An E element, last sibling of its type 9
  • 10. Structural Pseudo-classes (3)  E:only-child  An E element, only child of its parent  E:only-of-type  An E element, only sibling of its type  E:empty  An E element that has no children (including text nodes)  More detailed descriptions: http://www.w3.org/TR/css3-selectors/#structural-pseudos 10
  • 11. Structural Selectors Live Demo
  • 12. The UI Element States Pseudo-classes  E:enabled  A user interface element E which is enabled  E:disabled  A user interface element E which is disabled  E:checked  A user interface element E which is checked (for instance a radio-button or checkbox)  Currently supported only in Opera! 12
  • 13. UI Selectors Live Demo
  • 14. Other CSS 3 Selectors  E:target  An E element being the target of the referring URI  E:not(s)  An E element that does not match simple selector E ~ F  An F element preceded by an E element 14
  • 15. Other CSS 3 Selectors Live Demo
  • 16. Fonts
  • 17. Font Embeds  Use @font-face to declare font  Point to font file on server  Call font with font-family  Currently not supported in IE  Use font embedding instead of images @font-face { font-family: SketchRockwell; src: url('SketchRockwell-Bold.ttf'); } .my_CSS3_class { font-family: SketchRockwell; font-size: 3.2em; 17 }
  • 18. Text Shadow  Applies shadow to text  Syntax: text-shadow: <horizontal- distance> <vertical-distance> <blur-radius> <shadow-color>;  Do not alter the size of a box text-shadow: 2px 2px 7px #000000; 18
  • 19. Text Overflow  Specifies what should happen when text overflows the containing element  Syntax: text-overflow: <value>;  Possible values:  ellipsis - Display ellipses to represent clipped text  clip - Default value, clips text  Currently not supported in Firefox and IE 19
  • 20. Word Wrapping  Allows long words to be able to be broken and wrap onto the next line  Syntax: word-wrap: <value>;  Possible values:  normal  break-word  Supported in all major browsers 20
  • 21. CSS 3 Fonts Live Demo
  • 23. Opacity  Sets the opacity level for an element  Syntax: opacity: <value>;  Value from 0.0 (fully transparent) to 1.0  The opacity is supported in all major browsers.  Note: IE8 and earlier supports an alternative, the filter property: filter: Alpha(opacity=50).  Example: <img src="img.jpg" style= " opacity: 0.4; filter: alpha(opacity=40)" /> 23
  • 24. RGBA Colors  Standard RGB colors with an opacity value for the color (alpha channel)  Syntax: rgba(<red>, <green>, <blue>, <alpha>)  The range for red, green and blue is between integers 0 and 255  The range for the alpha channel is between 0.0 and 1.0  Example: rgba(255, 0, 0, 0.5) 24
  • 25. HSL Colors  Hue is a degree on the color wheel  0 (or 360) is red, 120 is green, 240 is blue  Saturation is a percentage value  100% is the full color  Lightness is also a percentage  0% is dark (black)  100% is light (white)  50% is the average 25
  • 26. HSLA Colors  HSLA allows a fourth value, which sets the Opacity (via the Alpha channel) of the element.  As RGBA is to RGB, HSLA is to HSL  Supported in IE9+, Firefox 3+, Chrome, Safari, and in Opera 10+  Example:  hsla(0, 100%, 50%, 0.5)  Result: 26
  • 27. CSS 3 Colors Live Demo
  • 29. Gradient Backgrounds  Gradients are smooth transitions between two or more specified colors  Use of CSS gradients can replace images and reduce download time  Create a more flexible layout, and look better while zooming  Supported in all major browsers via different keywords  This is still an experimental feature 29
  • 30. Gradient Backgrounds Example /* Firefox 3.6+ */ background: -moz-linear-gradient(100% 100% 90deg, #FFFF00, #0000FF); /* Safari 4-5, Chrome 1-9 */ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#0000FF), to(#FFFF00)); /* Safari 5.1+, Chrome 10+ */ background: -webkit-linear-gradient(#FFFF00, #0000FF); /* Opera 11.10+ */ background: -o-linear-gradient(#2F2727, #0000FF); 30
  • 31. Multiple Backgrounds  CSS3 allows multiple background images  Simple comma-separated list of images  Supported in Firefox (3.6+), Chrome (1.0/1.3+), Opera (10.5+) and Internet Explorer (9.0+)  Comma separated list for the other properties background-image: url(sheep.png), url(grass.png); 31
  • 34. Border color  Allows you to create cool colored borders  Only Firefox supports this type of coloring border: 8px solid #000; -moz-border-bottom-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc; -moz-border-top-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc; -moz-border-left-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc; -moz-border-right-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc; 34
  • 35. Border radius  Allows web developers to easily utilize rounder corners in their design elements  Widespread browser support  Syntax: border-*-*-radius: [<length>|<%>][<length>|<%>]?  Example: -moz-border-radius: 15px; border-radius: 15px; background-color: #FF00FF; 35
  • 36. Box shadow  Allows to easily implement multiple drop shadows (outer or inner) on box elements  Specifying values for color, size, blur and offset  Example: -moz-box-shadow: 10px 10px 5px #888; -webkit-box-shadow: 10px 10px 5px #888; box-shadow: 10px 10px 5px #888; 36
  • 39. CSS3 box-sizing  Determine whether you want an element to render it's borders and padding within its specified width, or outside of it.  Possible values:  box-sizing: content-box (default) box width: 288 pixels + 10 pixels padding and 1 pixel border on each side = 300 pixels  box-sizing: border-box box width: 300 pixels, including padding and borders 39
  • 40. CSS3 box-sizing (Example)  Example: Box with total width of 300 px (including paddings and borders) width: 300px; border: 1px solid black; padding: 5px; /* Firefox */ -moz-box-sizing: border-box; /* WebKit */ -webkit-box-sizing: border-box; /* Opera 9.5+, Google Chrome */ box-sizing: border-box; 40
  • 41. CSS 3 Flexible Box Model  The flexible box model determines the way boxes are distributed inside other boxes and the way they share the available space.  New values for "display" property:  flexbox  inline-flexbox  This box model is still under development  Still not supported in major browsers 41
  • 42. CSS 3 Box Model Properties  flex-direction  Specifies how flexbox items are placed  flex-order  May be used to change the ordering of the elements. Elements are sorted by this value.  flex-pack  Defines the flexibility of packing spaces  flex-align  Changes the way free space is allocated 42
  • 43. CSS 3 flex-direction  The flex-direction property specifies how flexbox items are placed in the flexbox.  Possible values:  lr – Displays elements from left to right  rl – Displays elements from right to left  tb – Displays elements from top to bottom  bt – Displays elements from bottom to top  inline and inline-reverse  block and block-reverse 43
  • 46. Animations  Works in all webkit browsers  Example: @keyframes resize { 0% {...} 50% {...} 100% {...} } #box { animation-name: resize; animation-duration: 1s; animation-iteration-count: 4; animation-direction: alternate; animation-timing-function: ease-in-out; } 46
  • 47. Transitions  Add an effect when changing from one style to another  Different timing functions:  ease, ease-in, ease-out, ease-in-out, linear  Example: #id_of_element { -webkit-transition: all 1s ease-in-out; -moz-transition: all 1s ease-in-out; -o-transition: all 1s ease-in-out; -ms-transition: all 1s ease-in-out; transition: all 1s ease-in-out; } 47
  • 48. 2D Transformations  2D transforms are widely supported  Skew – skew element  transform: skew(35deg);  Scale – scale element  transform: scale(1,0.5);  Rotate – rotates element  transform: rotate(45deg);  Translate – moves element  transform: translate(10px, 20px); 48
  • 49. 3D Transformations  3D transforms are similar to 2D transforms  Only work in Safari and Chrome  X, Y and Z transformation  transform: rotateX(180deg);  transform: rotateY(180deg);  transform: rotateZ(180deg);  perspective: 800;  perspective-origin: 50% 100px;  translate3d, scale3d 49
  • 52. Exercises 1. Using your knowledge of CSS 3 style, the given HTML code and approximate the end result (shown in the image below: <div id="example_form"> <h1>Example form</h1> Your name: <input value="Mark DuBois"/> Your email: <input value="Mark@...." /> <input value="Subscribe" type="submit" /> </div> 52
  • 53. Exercises (2) 1. Using CSS3 make a rotating 3D Rubik Cube. 2. Using CSS3 make a text that is pulsing, i.e. gets bigger, then smaller, etc. while blinking with different colors. 3. Using CSS3 make a text bouncing around the screen (the browser).  Hint: the text should change its position 53
  • 54. Exercises (3) 1. Using CSS3 make a landscape with a lake/sea with ships moving in it. 54