SlideShare ist ein Scribd-Unternehmen logo
1 von 60
New elements in CSS3
Shadow Effect in CSS3
• -moz-box-shadow: 7px 7px 5px #999; /* For shadow effect to work in supported
versions of Mozilla */
• -webkit-box-shadow: 7px 7px 7px #999; /* For shadow effect to work in
supported versions of Safari */
- See more at: http://blog.jmwhite.co.uk/2009/04/19/the-shadow-effect-in-css3/#sthash.XSkRPqSa.dpuf
CSS3 rounded
.rounded_STYLE
{
background-color: COLOR; /* if needed */
border: 1px solid BORDER_COLOR; /* if needed */
-webkit-border-radius: RADIUS; /* for Safari */
-moz-border-radius: RADIUS; /* for Firefox */
}
http://www.bestinclass.com/blog/2008/css3-border-radius-rounded-
corners-ie/
Border-image
• border-image:
• border-top-image
• border-right-image
• border-bottom-image
• border-left-image
• border-corner-image:
• border-top-left-image
• border-top-right-image
• border-bottom-left-image
• border-bottom-right-image
colored borders with CSS3
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; padding: 5px 5px 5px
15px;
Opacity Transition
<div style=" background: rgb(255, 0, 0) ; opacity: 0.2;"></div> <div
style=" background: rgb(255, 0, 0) ; opacity: 0.4;"></div> <div style="
background: rgb(255, 0, 0) ; opacity: 0.6;"></div> <div style="
background: rgb(255, 0, 0) ; opacity: 0.8;"></div> <div style="
background: rgb(255, 0, 0) ; opacity: 1;"></div>
RGBA colors
• CSS3 has added a new feature to color setting. Next to rgb you can
now also use rgba.
background: rgba(255, 0, 0, 0.2);
HSL Colors
• (Hue, Saturation, Lightness) values.
background-color: hsl(0,100%, 50%);
HSLA Colors
• As RGBA is to RGB, HSLA is to HSL; that is, it allows a fourth value,
which sets the Opacity (via the Alpha channel)
CSS3 Attribute Selectors
The CSS3 Selectors module introduces three new attribute selectors,
which are grouped together under the heading “Substring Matching
Attribute Selectors”.
• [att^=val] – the “begins with” selector
• [att$=val] – the “ends with” selector
• [att*=val] – the “contains” selecto
CSS3 Attribute Selectors
[att^=val] – the “begins with” selector
The Syntax
• element[att^=val]
Examples
• a[href^="http://"]
• p[title^="Hello"]
Other modules
• CSS3 Transitions
• media queries
• multi-column layout
• Web fonts
• speech
Multi-column layout
-moz-column-width: 13em; -webkit-column-width: 13em; -moz-
column-gap: 1em; -webkit-column-gap: 1em;
CSS3 Transitions
• transition-property
• transition-duration
• transition-timing-function
• transition-delay
http://www.css3.info/preview/css3-transitions/
Web fonts with @font-face
• @font-face { font-family: Delicious; src: url('Delicious-Roman.otf'); }
@font-face { font-family: Delicious; font-weight: bold; src:
url('Delicious-Bold.otf'); }
CSS3 Speech
• #voice-volume { -xv-voice-volume: x-soft; -xv-voice-balance: right; }
#voice-balance { -xv-voice-balance: left; } #speech-cue { cue-after:
url(ding.wav); } #voice-rate { -xv-voice-rate: x-slow; } #voice-family {
voice-family: female; } #voice-pitch { -xv-voice-pitch: x-low; } #speech-
speak { speak: spell-out; }
Media Queries
Why Media Queries
• Change our layouts to fit the exact need of different devices without
changing the content
• “One size fits all” Liquid, elastic and fixed width layouts
Why Media Queries cont.
• Just with CSS – no JavaScript
CSS media types
Media Type Description
all Used for all media type devices
aural Used for speech and sound synthesizers
braille Used for braille tactile feedback devices
embossed Used for paged braille printers
handheld Used for small or handheld devices
print Used for printers
projection Used for projected presentations, like slides
screen Used for computer screens
tty Used for media using a fixed-pitch character grid, like teletypes and
terminals
tv Used for television-type devices
http://www.w3.org/TR/CSS21/media.html
Specify Media
Method 1: <link> within HTML
You can use a <link> element in the head of your HTML document to
specify the target media of an external style sheet. <link
rel="stylesheet" href="a.css" type="text/css" media=”screen" />
Method 2: <?xml stylesheet> within XML
You can use <?xml-stylesheet ?> in the head of your XML document to
specify the target media of an external style sheet. <?xml-stylesheet
media="screen" rel="stylesheet" href="example.css" ?>
Specify Media
Method 3: @import within HTML
You can use @import in the head if your HTML document to specify the
target media of an external style sheet. <style type="text/css"
media="screen"> @import "a.css";</style>
Warning: @import should be avoided as it can cause issues in some
versions of Internet Explorer.
http://www.stevesouders.com/blog/2009/04/09/dont-use-import/
Specify Media
Method 4: @import within CSS
You can specify the target medium within a CSS file using @import
@import url("a.css") screen;
Media-types within @import rules are not supported by IE5, IE6 or IE7.
The rule is ignored.
Method 5: @media within CSS
You can specify the target medium within a CSS file using @media
@media screen { body { color: blue; } }
Media Queries cont…
• It’s a logical type (yes, No)
• If expression is true, it will apply to device
@media all and (min-width: 640px) { #media-queries-1 { background-
color: #0f0; } } @media screen and (max-width: 2000px) { #media-
queries-2 { background-color: #0f0; } }
Element Queries
• Element queries are not part of any CSS Specification. They basically
do not exist as of today. There are a couple of JavaScript-based
polyfills involving various syntaxes, but there is still no draft for a
native support.
SASS
SASS
Sass is an extension of CSS3 which adds nested rules, variables, mixins,
selector inheritance, and more. Sass generates well formatted CSS and
makes your stylesheets easier to organize and maintain.
SASS - Preprocessing
• When stylesheets are getting larger, more complex, and harder to
maintain. This is where a preprocessor can help. Sass lets you use
features that don't exist in CSS yet like variables, nesting, mixins,
inheritance and other nifty goodies that make writing CSS
SASS - Variables
• Think of variables as a way to store information that you want to
reuse throughout your stylesheet. You can store things like colors,
font stacks, or any CSS value you think you'll want to reuse. Sass uses
the $ symbol to make something a variable. Here's an example:
Sass CSS
$font-stack: Helvetica, sans-serif
$primary-color: #333
body
font:100% $font-stack
color: $primary-color
body { font: 100% Helvetica, sans-serif;
color: #333; }
SASS - Nesting
• When writing HTML you've probably noticed that it has a clear nested
and visual hierarchy. CSS, on the other hand, doesn't.
Sass CSS
nav
ul margin: 0 padding: 0 list-style:
none
li display: inline-block
a display: block padding: 6px 12px
text-decoration: none
nav ul {
margin: 0; padding: 0; list-style: none; }
nav li { display: inline-block; }
nav a { display: block; padding: 6px 12px;
text-decoration: none; }
SASS - Partials
• You can create partial Sass files that contain little snippets of CSS that
you can include in other Sass files. This is a great way to modularize
your CSS and help keep things easier to maintain. A partial is simply a
Sass file named with a leading underscore. You might name it
something like _partial.scss. The underscore lets Sass know that the
file is only a partial file and that it should not be generated into a CSS
file. Sass partials are used with the @import directive.
SASS - Import
• CSS has an import option that lets you split your CSS into smaller,
more maintainable portions. The only drawback is that each time you
use @import in CSS it creates another HTTP request. Sass builds on
top of the current CSS @import but instead of requiring an HTTP
request, Sass will take the file that you want to import and combine it
with the file you're importing into so you can serve a single CSS file to
the web browser.
Sass CSS
// _reset.sass html, body, ul, ol margin: 0
padding: 0
// base.sass @import reset body font:
100% Helvetica, sans-serif background-
color: #efefef
html, body, ul, ol { margin: 0; padding: 0;
}
body { font: 100% Helvetica, sans-serif;
background-color: #efefef; }
SASS - Mixins
• A mixin lets you make groups of CSS declarations that you want to
reuse throughout your site. You can even pass in values to make your
mixin more flexible. A good use of a mixin is for vendor prefixes
Sass CSS
=border-radius($radius) -webkit-border-
radius: $radius -moz-border-radius:
$radius -ms-border-radius: $radius
border-radius: $radius
.box +border-radius(10px)
.box { -webkit-border-radius: 10px; -moz-
border-radius: 10px; -ms-border-radius:
10px; border-radius: 10px; }
SASS - Extend/Inheritance
• This is one of the most useful features of Sass. Using @extend lets
you share a set of CSS properties from one selector to another.
Sass CSS
.message border: 1px solid #ccc padding:
10px color: #333
.success @extend
.message border-color: green
.error @extend .message border-color:
red
.warning @extend .message border-
color: yellow
.message, .success, .error, .warning {
border: 1px solid #cccccc; padding: 10px;
color: #333; }
.success { border-color: green; }
.error { border-color: red; }
.warning { border-color: yellow;
SASS - Operators
• Doing math in your CSS is very helpful. Sass has a handful of standard
math operators like +, -, *, /, and %. In our example we're going to do
some simple math to calculate widths for an aside & article.
Sass CSS
.container width: 100%
article[role="main"] float: left width:
600px / 960px * 100%
aside[role="complimentary"] float: right
width: 300px / 960px * 100%
.container { width: 100%; }
article[role="main"] { float: left; width:
62.5%; }
aside[role="complimentary"] { float:
right; width: 31.25%; }
LESS
LESS
• Less (also known as LESS) is a dynamic stylesheet language that can
be compiled into Cascading Style Sheets (CSS), or can run on the
client-side and server-side.
• Less was designed to be as close to CSS as possible, so the syntax is
identical to existing CSS code. As a result, existing CSS can be used as
valid Less code.
• The newer versions of Sass also introduced a CSS-like syntax called
SCSS (Sassy CSS).
Less
• Variables
• Mixins
• Nested rules
• Media query bubbling and nested media queries
• Operations
• Functions
• Namespaces and Accessors
• Scope
• Comments
• Importing
SASS vs LESS
05/16/12 01/12/13 06/25/13
Number of
open issues on
LESS
392 112 142
Number of
open issues on
Sass
84 83 110
Pending pull
requests on
LESS
86 10 5
Pending pull
requests on
Sass
3 7 11
Number of
commits in the
last month in
LESS
11 84 2
Number of
commits in the
last month in
Sass
35 14 14
http://css-tricks.com/sass-vs-less/
Compass
• Compass is an open-source CSS Authoring Framework.
Browser Support
• http://caniuse.com/
• http://www.w3schools.com/cssref/css3_browsersupport.asp
• http://css3test.com/
• Media-types within @import rules are not supported by IE5, IE6 or
IE7. The rule is ignored.
Frameworks
• Bootstrap
• Foundation
• Boilerplate
• Skeleton
Tools
Text Editors
• Sublime Text
Brackets
Other tools
• Yo
• Bower
• Grunt
• Phantom.js
• Jasmin
• Karma
Best Practice
Minimize HTTP Requests
• Combined files
• CSS Sprites
• Image maps
• Inline images - This can increase the size of your HTML document.
• Convert to Base 64
• Use CDN
• Add an Expires or a Cache-Control Header
• For static components: implement "Never expire" policy by setting far future
Expires header
• For dynamic components: use an appropriate Cache-Control header to help
the browser with conditional requests
• Gzip Components
• Accept-Encoding: gzip, deflate
• Content-Encoding: gzip
• Put Stylesheets at the Top
• Put Scripts at the Bottom (if the script uses document.write to insert
part of the page's content)
• Make JavaScript and CSS External
• Reduce DNS Lookups (add more hostnames)
• Minify JavaScript and CSS
• Avoid Redirects
HTTP/1.1 301 Moved Permanently
Location: http://example.com/newuri
Content-Type: text/html
• Remove Duplicate Scripts
• Reduce the Number of DOM Elements
• Split Components Across Domains
• Avoid Empty Image src
• Optimize CSS Sprites
• Minimize DOM Access
•
Others
• HTML5 Doctor CSS Reset - http://html5doctor.com/html-5-reset-
stylesheet/
• Lazy loading

Weitere ähnliche Inhalte

Was ist angesagt?

Quality Development with CSS3
Quality Development with CSS3Quality Development with CSS3
Quality Development with CSS3
Shay Howe
 

Was ist angesagt? (20)

Sass
SassSass
Sass
 
CSS Reset
CSS ResetCSS Reset
CSS Reset
 
Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.
 
Intro to CSS3
Intro to CSS3Intro to CSS3
Intro to CSS3
 
Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compass
 
Sass and compass workshop
Sass and compass workshopSass and compass workshop
Sass and compass workshop
 
SASS Lecture
SASS Lecture SASS Lecture
SASS Lecture
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors.
 
CSS3: Simply Responsive
CSS3: Simply ResponsiveCSS3: Simply Responsive
CSS3: Simply Responsive
 
Authoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & SassAuthoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & Sass
 
Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
 
Quality Development with CSS3
Quality Development with CSS3Quality Development with CSS3
Quality Development with CSS3
 
Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3
 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern libraries
 
CSS Preprocessors: LESS is more or look SASS-y trying
CSS Preprocessors: LESS is more or look SASS-y tryingCSS Preprocessors: LESS is more or look SASS-y trying
CSS Preprocessors: LESS is more or look SASS-y trying
 
CSS3 - is everything we used to do wrong?
CSS3 - is everything we used to do wrong? CSS3 - is everything we used to do wrong?
CSS3 - is everything we used to do wrong?
 
About Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSAbout Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JS
 
Modular HTML, CSS, & JS Workshop
Modular HTML, CSS, & JS WorkshopModular HTML, CSS, & JS Workshop
Modular HTML, CSS, & JS Workshop
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
 

Ähnlich wie CSS3

Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Erin M. Kidwell
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
mirahman
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
Itai Koren
 

Ähnlich wie CSS3 (20)

SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, Greensock
 
UNIT 3.ppt
UNIT 3.pptUNIT 3.ppt
UNIT 3.ppt
 
Create SASSy web parts in SPFx
Create SASSy web parts in SPFxCreate SASSy web parts in SPFx
Create SASSy web parts in SPFx
 
[Bauer] SASSy web parts with SPFX
[Bauer] SASSy web parts with SPFX[Bauer] SASSy web parts with SPFX
[Bauer] SASSy web parts with SPFX
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
Sass:-Syntactically Awesome Stylesheet by Shafeeq
Sass:-Syntactically Awesome Stylesheet by ShafeeqSass:-Syntactically Awesome Stylesheet by Shafeeq
Sass:-Syntactically Awesome Stylesheet by Shafeeq
 
Create SASSY Web Parts - SPSMilan
Create SASSY Web Parts - SPSMilan Create SASSY Web Parts - SPSMilan
Create SASSY Web Parts - SPSMilan
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
Sass_Cubet seminar
Sass_Cubet seminarSass_Cubet seminar
Sass_Cubet seminar
 
Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
 
Understanding sass
Understanding sassUnderstanding sass
Understanding sass
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
 
SASS Preprocessor
SASS PreprocessorSASS Preprocessor
SASS Preprocessor
 
Fasten RWD Development with Sass
Fasten RWD Development with SassFasten RWD Development with Sass
Fasten RWD Development with Sass
 
PostCss
PostCssPostCss
PostCss
 
Joes sass presentation
Joes sass presentationJoes sass presentation
Joes sass presentation
 
Sass compass
Sass compassSass compass
Sass compass
 
Stop your share point css become a di-sass-ter today - SPS Munich
Stop your share point css become a di-sass-ter today - SPS MunichStop your share point css become a di-sass-ter today - SPS Munich
Stop your share point css become a di-sass-ter today - SPS Munich
 

Mehr von Chathuranga Jayanath (7)

Redux Tech Talk
Redux Tech TalkRedux Tech Talk
Redux Tech Talk
 
Uml Basics
Uml Basics Uml Basics
Uml Basics
 
How To Say NO!
How To Say NO! How To Say NO!
How To Say NO!
 
Inauguration of Vision Academy of Professional Studies
Inauguration of Vision Academy of Professional Studies Inauguration of Vision Academy of Professional Studies
Inauguration of Vision Academy of Professional Studies
 
I os 6 to ios7 User Interface Perspective
I os 6  to  ios7 User Interface Perspective I os 6  to  ios7 User Interface Perspective
I os 6 to ios7 User Interface Perspective
 
Moodle for students and teachers
Moodle for students and teachersMoodle for students and teachers
Moodle for students and teachers
 
SLIIT - GTUG Introduction
SLIIT - GTUG IntroductionSLIIT - GTUG Introduction
SLIIT - GTUG Introduction
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

CSS3

  • 1.
  • 3. Shadow Effect in CSS3 • -moz-box-shadow: 7px 7px 5px #999; /* For shadow effect to work in supported versions of Mozilla */ • -webkit-box-shadow: 7px 7px 7px #999; /* For shadow effect to work in supported versions of Safari */ - See more at: http://blog.jmwhite.co.uk/2009/04/19/the-shadow-effect-in-css3/#sthash.XSkRPqSa.dpuf
  • 4. CSS3 rounded .rounded_STYLE { background-color: COLOR; /* if needed */ border: 1px solid BORDER_COLOR; /* if needed */ -webkit-border-radius: RADIUS; /* for Safari */ -moz-border-radius: RADIUS; /* for Firefox */ } http://www.bestinclass.com/blog/2008/css3-border-radius-rounded- corners-ie/
  • 5. Border-image • border-image: • border-top-image • border-right-image • border-bottom-image • border-left-image • border-corner-image: • border-top-left-image • border-top-right-image • border-bottom-left-image • border-bottom-right-image
  • 6. colored borders with CSS3 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; padding: 5px 5px 5px 15px;
  • 7. Opacity Transition <div style=" background: rgb(255, 0, 0) ; opacity: 0.2;"></div> <div style=" background: rgb(255, 0, 0) ; opacity: 0.4;"></div> <div style=" background: rgb(255, 0, 0) ; opacity: 0.6;"></div> <div style=" background: rgb(255, 0, 0) ; opacity: 0.8;"></div> <div style=" background: rgb(255, 0, 0) ; opacity: 1;"></div>
  • 8. RGBA colors • CSS3 has added a new feature to color setting. Next to rgb you can now also use rgba. background: rgba(255, 0, 0, 0.2);
  • 9. HSL Colors • (Hue, Saturation, Lightness) values. background-color: hsl(0,100%, 50%);
  • 10. HSLA Colors • As RGBA is to RGB, HSLA is to HSL; that is, it allows a fourth value, which sets the Opacity (via the Alpha channel)
  • 11. CSS3 Attribute Selectors The CSS3 Selectors module introduces three new attribute selectors, which are grouped together under the heading “Substring Matching Attribute Selectors”. • [att^=val] – the “begins with” selector • [att$=val] – the “ends with” selector • [att*=val] – the “contains” selecto
  • 12. CSS3 Attribute Selectors [att^=val] – the “begins with” selector The Syntax • element[att^=val] Examples • a[href^="http://"] • p[title^="Hello"]
  • 13. Other modules • CSS3 Transitions • media queries • multi-column layout • Web fonts • speech
  • 14. Multi-column layout -moz-column-width: 13em; -webkit-column-width: 13em; -moz- column-gap: 1em; -webkit-column-gap: 1em;
  • 15. CSS3 Transitions • transition-property • transition-duration • transition-timing-function • transition-delay http://www.css3.info/preview/css3-transitions/
  • 16. Web fonts with @font-face • @font-face { font-family: Delicious; src: url('Delicious-Roman.otf'); } @font-face { font-family: Delicious; font-weight: bold; src: url('Delicious-Bold.otf'); }
  • 17. CSS3 Speech • #voice-volume { -xv-voice-volume: x-soft; -xv-voice-balance: right; } #voice-balance { -xv-voice-balance: left; } #speech-cue { cue-after: url(ding.wav); } #voice-rate { -xv-voice-rate: x-slow; } #voice-family { voice-family: female; } #voice-pitch { -xv-voice-pitch: x-low; } #speech- speak { speak: spell-out; }
  • 19. Why Media Queries • Change our layouts to fit the exact need of different devices without changing the content • “One size fits all” Liquid, elastic and fixed width layouts
  • 20. Why Media Queries cont. • Just with CSS – no JavaScript
  • 21. CSS media types Media Type Description all Used for all media type devices aural Used for speech and sound synthesizers braille Used for braille tactile feedback devices embossed Used for paged braille printers handheld Used for small or handheld devices print Used for printers projection Used for projected presentations, like slides screen Used for computer screens tty Used for media using a fixed-pitch character grid, like teletypes and terminals tv Used for television-type devices http://www.w3.org/TR/CSS21/media.html
  • 22. Specify Media Method 1: <link> within HTML You can use a <link> element in the head of your HTML document to specify the target media of an external style sheet. <link rel="stylesheet" href="a.css" type="text/css" media=”screen" /> Method 2: <?xml stylesheet> within XML You can use <?xml-stylesheet ?> in the head of your XML document to specify the target media of an external style sheet. <?xml-stylesheet media="screen" rel="stylesheet" href="example.css" ?>
  • 23. Specify Media Method 3: @import within HTML You can use @import in the head if your HTML document to specify the target media of an external style sheet. <style type="text/css" media="screen"> @import "a.css";</style> Warning: @import should be avoided as it can cause issues in some versions of Internet Explorer. http://www.stevesouders.com/blog/2009/04/09/dont-use-import/
  • 24. Specify Media Method 4: @import within CSS You can specify the target medium within a CSS file using @import @import url("a.css") screen; Media-types within @import rules are not supported by IE5, IE6 or IE7. The rule is ignored. Method 5: @media within CSS You can specify the target medium within a CSS file using @media @media screen { body { color: blue; } }
  • 25. Media Queries cont… • It’s a logical type (yes, No) • If expression is true, it will apply to device @media all and (min-width: 640px) { #media-queries-1 { background- color: #0f0; } } @media screen and (max-width: 2000px) { #media- queries-2 { background-color: #0f0; } }
  • 27. • Element queries are not part of any CSS Specification. They basically do not exist as of today. There are a couple of JavaScript-based polyfills involving various syntaxes, but there is still no draft for a native support.
  • 28. SASS
  • 29. SASS Sass is an extension of CSS3 which adds nested rules, variables, mixins, selector inheritance, and more. Sass generates well formatted CSS and makes your stylesheets easier to organize and maintain.
  • 30. SASS - Preprocessing • When stylesheets are getting larger, more complex, and harder to maintain. This is where a preprocessor can help. Sass lets you use features that don't exist in CSS yet like variables, nesting, mixins, inheritance and other nifty goodies that make writing CSS
  • 31. SASS - Variables • Think of variables as a way to store information that you want to reuse throughout your stylesheet. You can store things like colors, font stacks, or any CSS value you think you'll want to reuse. Sass uses the $ symbol to make something a variable. Here's an example: Sass CSS $font-stack: Helvetica, sans-serif $primary-color: #333 body font:100% $font-stack color: $primary-color body { font: 100% Helvetica, sans-serif; color: #333; }
  • 32. SASS - Nesting • When writing HTML you've probably noticed that it has a clear nested and visual hierarchy. CSS, on the other hand, doesn't. Sass CSS nav ul margin: 0 padding: 0 list-style: none li display: inline-block a display: block padding: 6px 12px text-decoration: none nav ul { margin: 0; padding: 0; list-style: none; } nav li { display: inline-block; } nav a { display: block; padding: 6px 12px; text-decoration: none; }
  • 33. SASS - Partials • You can create partial Sass files that contain little snippets of CSS that you can include in other Sass files. This is a great way to modularize your CSS and help keep things easier to maintain. A partial is simply a Sass file named with a leading underscore. You might name it something like _partial.scss. The underscore lets Sass know that the file is only a partial file and that it should not be generated into a CSS file. Sass partials are used with the @import directive.
  • 34. SASS - Import • CSS has an import option that lets you split your CSS into smaller, more maintainable portions. The only drawback is that each time you use @import in CSS it creates another HTTP request. Sass builds on top of the current CSS @import but instead of requiring an HTTP request, Sass will take the file that you want to import and combine it with the file you're importing into so you can serve a single CSS file to the web browser. Sass CSS // _reset.sass html, body, ul, ol margin: 0 padding: 0 // base.sass @import reset body font: 100% Helvetica, sans-serif background- color: #efefef html, body, ul, ol { margin: 0; padding: 0; } body { font: 100% Helvetica, sans-serif; background-color: #efefef; }
  • 35. SASS - Mixins • A mixin lets you make groups of CSS declarations that you want to reuse throughout your site. You can even pass in values to make your mixin more flexible. A good use of a mixin is for vendor prefixes Sass CSS =border-radius($radius) -webkit-border- radius: $radius -moz-border-radius: $radius -ms-border-radius: $radius border-radius: $radius .box +border-radius(10px) .box { -webkit-border-radius: 10px; -moz- border-radius: 10px; -ms-border-radius: 10px; border-radius: 10px; }
  • 36. SASS - Extend/Inheritance • This is one of the most useful features of Sass. Using @extend lets you share a set of CSS properties from one selector to another. Sass CSS .message border: 1px solid #ccc padding: 10px color: #333 .success @extend .message border-color: green .error @extend .message border-color: red .warning @extend .message border- color: yellow .message, .success, .error, .warning { border: 1px solid #cccccc; padding: 10px; color: #333; } .success { border-color: green; } .error { border-color: red; } .warning { border-color: yellow;
  • 37. SASS - Operators • Doing math in your CSS is very helpful. Sass has a handful of standard math operators like +, -, *, /, and %. In our example we're going to do some simple math to calculate widths for an aside & article. Sass CSS .container width: 100% article[role="main"] float: left width: 600px / 960px * 100% aside[role="complimentary"] float: right width: 300px / 960px * 100% .container { width: 100%; } article[role="main"] { float: left; width: 62.5%; } aside[role="complimentary"] { float: right; width: 31.25%; }
  • 38. LESS
  • 39. LESS • Less (also known as LESS) is a dynamic stylesheet language that can be compiled into Cascading Style Sheets (CSS), or can run on the client-side and server-side.
  • 40. • Less was designed to be as close to CSS as possible, so the syntax is identical to existing CSS code. As a result, existing CSS can be used as valid Less code. • The newer versions of Sass also introduced a CSS-like syntax called SCSS (Sassy CSS).
  • 41. Less • Variables • Mixins • Nested rules • Media query bubbling and nested media queries • Operations • Functions • Namespaces and Accessors • Scope • Comments • Importing
  • 42. SASS vs LESS 05/16/12 01/12/13 06/25/13 Number of open issues on LESS 392 112 142 Number of open issues on Sass 84 83 110 Pending pull requests on LESS 86 10 5 Pending pull requests on Sass 3 7 11 Number of commits in the last month in LESS 11 84 2 Number of commits in the last month in Sass 35 14 14 http://css-tricks.com/sass-vs-less/
  • 44. • Compass is an open-source CSS Authoring Framework.
  • 47. • Media-types within @import rules are not supported by IE5, IE6 or IE7. The rule is ignored.
  • 49. • Bootstrap • Foundation • Boilerplate • Skeleton
  • 50. Tools
  • 51. Text Editors • Sublime Text Brackets
  • 52. Other tools • Yo • Bower • Grunt • Phantom.js • Jasmin • Karma
  • 54. Minimize HTTP Requests • Combined files • CSS Sprites • Image maps • Inline images - This can increase the size of your HTML document. • Convert to Base 64
  • 55. • Use CDN • Add an Expires or a Cache-Control Header • For static components: implement "Never expire" policy by setting far future Expires header • For dynamic components: use an appropriate Cache-Control header to help the browser with conditional requests • Gzip Components • Accept-Encoding: gzip, deflate • Content-Encoding: gzip
  • 56. • Put Stylesheets at the Top • Put Scripts at the Bottom (if the script uses document.write to insert part of the page's content) • Make JavaScript and CSS External • Reduce DNS Lookups (add more hostnames) • Minify JavaScript and CSS
  • 57. • Avoid Redirects HTTP/1.1 301 Moved Permanently Location: http://example.com/newuri Content-Type: text/html • Remove Duplicate Scripts • Reduce the Number of DOM Elements • Split Components Across Domains
  • 58. • Avoid Empty Image src • Optimize CSS Sprites • Minimize DOM Access •
  • 60. • HTML5 Doctor CSS Reset - http://html5doctor.com/html-5-reset- stylesheet/ • Lazy loading