SlideShare ist ein Scribd-Unternehmen logo
1 von 91
Downloaden Sie, um offline zu lesen
CSS3
COLORS
Before we talk about CSS3
colors, we need to review
     CSS2.1 colors.
CSS2.1
Colors
CSS2.1 allowed colors to be
defined using six different types
           of values.
1   Keywords
2   Six-digit hexadecimal notation
3   Three-digit hexadecimal notation
4   RGB numeric notation
5   RGB percentage notation
6   System colors
1. Keywords
CSS2.1 allowed 17 keywords:
aqua, black, blue, fuchsia, gray,
green, lime, maroon, navy, olive,
 orange, purple, red, silver, teal,
        white, and yellow.
Example keywords:



p   {   color:   aqua; }
p   {   color:   black; }
p   {   color:   blue; }
p   {   color:   fuchsia; }
p   {   color:   gray; }
p   {   color:   green; }
p   {   color:   lime; }
2. Six-digit
hexadecimal
  notation
Six-digit hexadecimal notation
           (#rrggbb):



   p { color: #AE03FF; }
3. Three-digit
hexadecimal
   notation
Three-digit hexadecimal
   notation allows authors to
 replace double ‘rr’, ‘gg’ or ‘bb’
values with single values (#rgb):


   p   {   color:   #663399; }
   p   {   color:   #639; }
   p   {   color:   #aaff55; }
   p   {   color:   #af5; }
The six-digit RGB notation
 (#rrggbb) can only by converted
into three-digit form (#rgb) if each
  the rr, gg, and bb values each
 use duplicate digits. Many six-
digit values cannot be converted.

                             Cannot convert
    p { color: #953d3d; }
    p { color: #34d209; }    Cannot convert
4. RGB numeric
    notation
RGB numeric notation
uses 'rgb(' followed by a comma-
 separated list of three integer
     values, followed by ‘)’.



   p {
   color: rgb(109, 22, 255); }
RGB numeric notation allows
values between 0 (black) and 255
    (white). No unit identifier is
              required.
5. RGB percentage
     notation
RGB percentage notation uses
   'rgb(' followed by a comma-
separated list of three percentage
      values, followed by ')'.

    p {
    color: rgb(0%,10%,100%); }
RGB percentage notation
  allows values between 0%
 (black) and 100% (white). All
values must include % symbol.
6. System colors
CSS2.1 allowed System colors
to be used to specify colors that
matched the operating system's
         graphic style.

   p { color: ButtonFace; }
Note:
 System Colors have been
 deprecated in favor of the
   CSS3 UI “appearance’
 property for specifying the
   complete look of user
interface related elements.
CSS3 Colors
With CSS3, we can now apply
   colours using eight new
          methods:
1   Extended color keywords
2   Opacity
3   RGBA numeric notation
4   RGBA percentage notation
5   HSL notation
6   HSLA notation
7   The ‘currentColor’ keyword
8   The ‘transparent’ keyword
1. Extended Color
    Keywords
While CSS2.1 allowed us to use
17 basic color keywords, CSS3
 allows us to use and additional
130 extended color keywords.
This is a total of 147 keywords.
Example color keywords:



p   {   color:   peru; }
p   {   color:   salmon; }
p   {   color:   thisle; }
p   {   color:   firebrick; }
p   {   color:   ghostwhite; }
p   {   color:   goldenrod; }
p   {   color:   honeydew; }
Quick tip:
Do you have trouble spelling the
       keyword gray/grey?
Well, CSS3 color keywords have
 got you covered. They include
    gray, grey, darkgrey and
            darkgray.
Browser          Supported
Firefox 3.6, 4   Yes
Safari 4, 5      Yes
Chrome 9, 10     Yes
Opera 10, 11     Yes
IE 6, 7, 8, 9    Yes
2. Opacity
Opacity allows us to dictate the
  opacity/transparency of
           elements.
Opacity values range from 0 (or
 0.0), which is fully transparent to
 1 (or 1.0) which is 100% opaque.


p { opacity: 0.3; }
The opacity value must be a
number, which is zero or more
   digits followed by a dot (.)
followed by one or more digits.
           For example:

             0.5
             .5
Be aware that this property will
set the opacity for the element
and all of it’s child elements.
Browser          Supported
Firefox 3.6, 4   Yes
Safari 4, 5      Yes
Chrome 9, 10     Yes
Opera 10, 11     Yes
IE 6, 7, 8       No
IE 9             Yes
3. RGBA numeric
    notation
With CSS3 we can add an alpha
 channel to RGB values. This
 allows us to set our colors to
    specific levels of opacity.
While the ‘opacity’ property
sets the opacity/transparency of
entire elements, RGBA is used
  to set the opacity of color
          values only.
RGBA numeric notation
      uses 'rgba(' followed by a
   comma-separated list of three
   integer values, followed by an
    alpha value followed by a ‘)’.


p { color: rgba(100, 66, 255, 1); }
The three integer values must be
   between 0 (black) and 255
   (white). No unit identifier is
     required. For example:

             255
              0
This alpha value must be a
number, which is zero or more
   digits followed by a dot (.)
followed by one or more digits.
           For example:

             0.5
             .5
An alpha value of 1 means
the color will be fully opaque
 (displayed as a solid color).
An alpha value of 0.5 will be
         half opaque.
You should always include a
    backup for browsers that do not
        support this property.


p
{
     color: rgb(100, 66, 255);
     color: rgba(100, 66, 255, 0.5);
}
Browser          Supported
Firefox 3.6, 4   Yes
Safari 4, 5      Yes
Chrome 9, 10     Yes
Opera 10, 11     Yes
IE 6, 7, 8       No
IE 9             Yes
4. RGBA percentage
     notation
RGBA percentage notation
     uses 'rgba(' followed by a
   comma-separated list of three
  percentage values, followed by
  an alpha value followed by a ‘)’.


p { color: rgba(10%, 6%, 20%, 1); }
The three percentage values
must be between 0% (black) and
  100% (white). All values must
include % symbol. For example:

           100%
            0%
This alpha value must be a
number, which is zero or more
   digits followed by a dot (.)
followed by one or more digits.
           For example:

             0.5
             .5
Browser          Supported
Firefox 3.6, 4   Yes
Safari 4, 5      Yes
Chrome 9, 10     Yes
Opera 10, 11     Yes
IE 6, 7, 8       No
IE 9             Yes
5. HSL notation
HSL notation allows us to define
 colors using hue, saturation
        and lightness.
HSL notation is written like this:




p { color: hsl(280,100%,50%); }
The first value is for Hue and
  must be a integer value between
             0 and 359.


p { color: hsl(280,100%,50%); }
The second value is for
  Saturation and must be defined
      as a percentage value.


p { color: hsl(280,100%,50%); }
The third value is Lightness
   and must also be defined as a
         percentage value.


p { color: hsl(280,100%,50%); }
These three HSL values must
    be separated by commas.
   Whitespace after the commas
            is optional.

p { color: hsl(280,100%,50%); }
You should always include a
    backup color that is not HSL for
           older browsers.


p
{
     color: rgb(85,0,128);
     color: hsl(280,100%,50%);
}
Browser          Supported
Firefox 3.6, 4   Yes
Safari 4, 5      Yes
Chrome 9, 10     Yes
Opera 10, 11     Yes
IE 6, 7, 8       No
IE 9             Yes
6. HSLA notation
Like RGBA, we can add an alpha
   channel to HSL values. This
   allows us to set our colors to
     specific levels of opacity.
First of all, we need to change the
             HSL to HSLA:



p { color: hsla(280,100%,50%); }
Then, we need to add a new
   value at the end of the three
    comma-separated values.


p { color: hsla(280,100%,50%,0.5); }
The opacity value must be a
number, which is zero or more
   digits followed by a dot (.)
followed by one or more digits.
           For example:

             0.5
             .5
You should always include a
    backup color that is not HSL or
      HSLA for older browsers.


p
{
     color: rgb(85,0,128);
     color: hsla(280,100%,50%,0.5);
}
Browser          Supported
Firefox 3.6, 4   Yes
Safari 4, 5      Yes
Chrome 9, 10     Yes
Opera 10, 11     Yes
IE 6, 7, 8       No
IE 9             Yes
Why use HSL
 or HSLA?
From the browsers point of view,
there is no difference between
   values defined in RGBA
           or HSLA.
Some designers find it easier
to choose and adjust colors
       using HSLA.
7. The ‘currentColor’
      keyword
CSS1 and CSS2 defined
the initial value of the ‘border-
   color’ property to be “the
value of the ‘color’ property” .
    However, there is no
  corresponding keyword.
We had no way of specifying a
    border-color to match the color.

p
{
     color: red;
     border-width: 1px;
     border-style: solid;
     border-color: “the value of the
     ‘color’ property”;
}
CSS3 allows us to the
    currentColor keyword for this:

p
{
     color: red;
     border-width: 1px;
     border-style: solid;
     border-color: currentColor;
}
Browser           Supported
Firefox 3.6, 4    Yes
Safari 4, 5       Yes
Chrome 8, 9, 10   Yes
Opera 11          Yes
IE 6, 7, 8        No
IE 9              Yes
8. The ‘transparent’
     keyword
CSS1 introduced the ‘transparent’
 value for the background-color
             property.
CSS2 allowed the ‘transparent’
value to be applied to the ‘border-
          color’ property.
CSS3 allows the ‘transparent’
   keyword to be applied to any
     properties that accepts
         a ‘color’ value.



p { color: transparent; }
Browser          Supported
Firefox 3.6, 4   Yes
Safari 4, 5      Yes
Chrome 9, 10     Yes
Opera 10, 11     Yes
IE 6, 7, 8       No
IE 9             Yes
Russ Weakley
Max Design

Site: maxdesign.com.au
Twitter: twitter.com/russmaxdesign
Slideshare: slideshare.net/maxdesign
Linkedin: linkedin.com/in/russweakley

Weitere ähnliche Inhalte

Ähnlich wie CSS3 cores e transparencia

Handout2 formatting tags
Handout2 formatting tagsHandout2 formatting tags
Handout2 formatting tags
Nadine Guevarra
 

Ähnlich wie CSS3 cores e transparencia (20)

Css3 color
Css3 colorCss3 color
Css3 color
 
Css3 color
Css3 colorCss3 color
Css3 color
 
Css ejemplos y codigo 1
Css ejemplos y codigo 1Css ejemplos y codigo 1
Css ejemplos y codigo 1
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and Backgrounds
 
CSS 3
CSS 3CSS 3
CSS 3
 
CSS3: Border And Colors
CSS3: Border And ColorsCSS3: Border And Colors
CSS3: Border And Colors
 
Colour
ColourColour
Colour
 
Colors In CSS3
Colors In CSS3Colors In CSS3
Colors In CSS3
 
Css3 Complete Reference
Css3 Complete ReferenceCss3 Complete Reference
Css3 Complete Reference
 
Advanced css colors
Advanced css colorsAdvanced css colors
Advanced css colors
 
Css gradients
Css gradientsCss gradients
Css gradients
 
Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)
 
CSS 3 Overview
CSS 3 OverviewCSS 3 Overview
CSS 3 Overview
 
CSS3
CSS3CSS3
CSS3
 
css trasition explanation about our project
css trasition explanation about our projectcss trasition explanation about our project
css trasition explanation about our project
 
Handout2 formatting tags
Handout2 formatting tagsHandout2 formatting tags
Handout2 formatting tags
 
JS Fest 2019. Mauricio Palma. You can’t read this sentence - A11y automation
JS Fest 2019. Mauricio Palma. You can’t read this sentence - A11y automationJS Fest 2019. Mauricio Palma. You can’t read this sentence - A11y automation
JS Fest 2019. Mauricio Palma. You can’t read this sentence - A11y automation
 
Compass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperCompass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS Developer
 
Css
CssCss
Css
 
Web - CSS 1.pptx
Web - CSS 1.pptxWeb - CSS 1.pptx
Web - CSS 1.pptx
 

Kürzlich hochgeladen

ab-initio-training basics and architecture
ab-initio-training basics and architectureab-initio-training basics and architecture
ab-initio-training basics and architecture
saipriyacoool
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdf
tbatkhuu1
 
➥🔝 7737669865 🔝▻ Bokaro Call-girls in Women Seeking Men 🔝Bokaro🔝 Escorts S...
➥🔝 7737669865 🔝▻ Bokaro Call-girls in Women Seeking Men  🔝Bokaro🔝   Escorts S...➥🔝 7737669865 🔝▻ Bokaro Call-girls in Women Seeking Men  🔝Bokaro🔝   Escorts S...
➥🔝 7737669865 🔝▻ Bokaro Call-girls in Women Seeking Men 🔝Bokaro🔝 Escorts S...
amitlee9823
 
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
gajnagarg
 
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
instagramfab782445
 
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman MuscatAbortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion pills in Kuwait Cytotec pills in Kuwait
 
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
eeanqy
 
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
nirzagarg
 

Kürzlich hochgeladen (20)

ab-initio-training basics and architecture
ab-initio-training basics and architectureab-initio-training basics and architecture
ab-initio-training basics and architecture
 
The hottest UI and UX Design Trends 2024
The hottest UI and UX Design Trends 2024The hottest UI and UX Design Trends 2024
The hottest UI and UX Design Trends 2024
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdf
 
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
 
Just Call Vip call girls Nagpur Escorts ☎️8617370543 Starting From 5K to 25K ...
Just Call Vip call girls Nagpur Escorts ☎️8617370543 Starting From 5K to 25K ...Just Call Vip call girls Nagpur Escorts ☎️8617370543 Starting From 5K to 25K ...
Just Call Vip call girls Nagpur Escorts ☎️8617370543 Starting From 5K to 25K ...
 
➥🔝 7737669865 🔝▻ Bokaro Call-girls in Women Seeking Men 🔝Bokaro🔝 Escorts S...
➥🔝 7737669865 🔝▻ Bokaro Call-girls in Women Seeking Men  🔝Bokaro🔝   Escorts S...➥🔝 7737669865 🔝▻ Bokaro Call-girls in Women Seeking Men  🔝Bokaro🔝   Escorts S...
➥🔝 7737669865 🔝▻ Bokaro Call-girls in Women Seeking Men 🔝Bokaro🔝 Escorts S...
 
Sector 104, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 104, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 104, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 104, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
 
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
 
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
 
Sweety Planet Packaging Design Process Book.pptx
Sweety Planet Packaging Design Process Book.pptxSweety Planet Packaging Design Process Book.pptx
Sweety Planet Packaging Design Process Book.pptx
 
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman MuscatAbortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
 
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
 
❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.
❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.
❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.
 
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentation
 
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
 
call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
 
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
 
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
 

CSS3 cores e transparencia

  • 2. Before we talk about CSS3 colors, we need to review CSS2.1 colors.
  • 4. CSS2.1 allowed colors to be defined using six different types of values.
  • 5. 1 Keywords 2 Six-digit hexadecimal notation 3 Three-digit hexadecimal notation 4 RGB numeric notation 5 RGB percentage notation 6 System colors
  • 7. CSS2.1 allowed 17 keywords: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow.
  • 8. Example keywords: p { color: aqua; } p { color: black; } p { color: blue; } p { color: fuchsia; } p { color: gray; } p { color: green; } p { color: lime; }
  • 10. Six-digit hexadecimal notation (#rrggbb): p { color: #AE03FF; }
  • 12. Three-digit hexadecimal notation allows authors to replace double ‘rr’, ‘gg’ or ‘bb’ values with single values (#rgb): p { color: #663399; } p { color: #639; } p { color: #aaff55; } p { color: #af5; }
  • 13. The six-digit RGB notation (#rrggbb) can only by converted into three-digit form (#rgb) if each the rr, gg, and bb values each use duplicate digits. Many six- digit values cannot be converted. Cannot convert p { color: #953d3d; } p { color: #34d209; } Cannot convert
  • 14. 4. RGB numeric notation
  • 15. RGB numeric notation uses 'rgb(' followed by a comma- separated list of three integer values, followed by ‘)’. p { color: rgb(109, 22, 255); }
  • 16. RGB numeric notation allows values between 0 (black) and 255 (white). No unit identifier is required.
  • 17. 5. RGB percentage notation
  • 18. RGB percentage notation uses 'rgb(' followed by a comma- separated list of three percentage values, followed by ')'. p { color: rgb(0%,10%,100%); }
  • 19. RGB percentage notation allows values between 0% (black) and 100% (white). All values must include % symbol.
  • 21. CSS2.1 allowed System colors to be used to specify colors that matched the operating system's graphic style. p { color: ButtonFace; }
  • 22. Note: System Colors have been deprecated in favor of the CSS3 UI “appearance’ property for specifying the complete look of user interface related elements.
  • 24. With CSS3, we can now apply colours using eight new methods:
  • 25. 1 Extended color keywords 2 Opacity 3 RGBA numeric notation 4 RGBA percentage notation 5 HSL notation 6 HSLA notation 7 The ‘currentColor’ keyword 8 The ‘transparent’ keyword
  • 26. 1. Extended Color Keywords
  • 27. While CSS2.1 allowed us to use 17 basic color keywords, CSS3 allows us to use and additional 130 extended color keywords. This is a total of 147 keywords.
  • 28. Example color keywords: p { color: peru; } p { color: salmon; } p { color: thisle; } p { color: firebrick; } p { color: ghostwhite; } p { color: goldenrod; } p { color: honeydew; }
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40. Quick tip: Do you have trouble spelling the keyword gray/grey? Well, CSS3 color keywords have got you covered. They include gray, grey, darkgrey and darkgray.
  • 41. Browser Supported Firefox 3.6, 4 Yes Safari 4, 5 Yes Chrome 9, 10 Yes Opera 10, 11 Yes IE 6, 7, 8, 9 Yes
  • 43. Opacity allows us to dictate the opacity/transparency of elements.
  • 44. Opacity values range from 0 (or 0.0), which is fully transparent to 1 (or 1.0) which is 100% opaque. p { opacity: 0.3; }
  • 45. The opacity value must be a number, which is zero or more digits followed by a dot (.) followed by one or more digits. For example: 0.5 .5
  • 46. Be aware that this property will set the opacity for the element and all of it’s child elements.
  • 47. Browser Supported Firefox 3.6, 4 Yes Safari 4, 5 Yes Chrome 9, 10 Yes Opera 10, 11 Yes IE 6, 7, 8 No IE 9 Yes
  • 48. 3. RGBA numeric notation
  • 49. With CSS3 we can add an alpha channel to RGB values. This allows us to set our colors to specific levels of opacity.
  • 50. While the ‘opacity’ property sets the opacity/transparency of entire elements, RGBA is used to set the opacity of color values only.
  • 51. RGBA numeric notation uses 'rgba(' followed by a comma-separated list of three integer values, followed by an alpha value followed by a ‘)’. p { color: rgba(100, 66, 255, 1); }
  • 52. The three integer values must be between 0 (black) and 255 (white). No unit identifier is required. For example: 255 0
  • 53. This alpha value must be a number, which is zero or more digits followed by a dot (.) followed by one or more digits. For example: 0.5 .5
  • 54. An alpha value of 1 means the color will be fully opaque (displayed as a solid color). An alpha value of 0.5 will be half opaque.
  • 55. You should always include a backup for browsers that do not support this property. p { color: rgb(100, 66, 255); color: rgba(100, 66, 255, 0.5); }
  • 56. Browser Supported Firefox 3.6, 4 Yes Safari 4, 5 Yes Chrome 9, 10 Yes Opera 10, 11 Yes IE 6, 7, 8 No IE 9 Yes
  • 57. 4. RGBA percentage notation
  • 58. RGBA percentage notation uses 'rgba(' followed by a comma-separated list of three percentage values, followed by an alpha value followed by a ‘)’. p { color: rgba(10%, 6%, 20%, 1); }
  • 59. The three percentage values must be between 0% (black) and 100% (white). All values must include % symbol. For example: 100% 0%
  • 60. This alpha value must be a number, which is zero or more digits followed by a dot (.) followed by one or more digits. For example: 0.5 .5
  • 61. Browser Supported Firefox 3.6, 4 Yes Safari 4, 5 Yes Chrome 9, 10 Yes Opera 10, 11 Yes IE 6, 7, 8 No IE 9 Yes
  • 63. HSL notation allows us to define colors using hue, saturation and lightness.
  • 64. HSL notation is written like this: p { color: hsl(280,100%,50%); }
  • 65. The first value is for Hue and must be a integer value between 0 and 359. p { color: hsl(280,100%,50%); }
  • 66. The second value is for Saturation and must be defined as a percentage value. p { color: hsl(280,100%,50%); }
  • 67. The third value is Lightness and must also be defined as a percentage value. p { color: hsl(280,100%,50%); }
  • 68. These three HSL values must be separated by commas. Whitespace after the commas is optional. p { color: hsl(280,100%,50%); }
  • 69. You should always include a backup color that is not HSL for older browsers. p { color: rgb(85,0,128); color: hsl(280,100%,50%); }
  • 70. Browser Supported Firefox 3.6, 4 Yes Safari 4, 5 Yes Chrome 9, 10 Yes Opera 10, 11 Yes IE 6, 7, 8 No IE 9 Yes
  • 72. Like RGBA, we can add an alpha channel to HSL values. This allows us to set our colors to specific levels of opacity.
  • 73. First of all, we need to change the HSL to HSLA: p { color: hsla(280,100%,50%); }
  • 74. Then, we need to add a new value at the end of the three comma-separated values. p { color: hsla(280,100%,50%,0.5); }
  • 75. The opacity value must be a number, which is zero or more digits followed by a dot (.) followed by one or more digits. For example: 0.5 .5
  • 76. You should always include a backup color that is not HSL or HSLA for older browsers. p { color: rgb(85,0,128); color: hsla(280,100%,50%,0.5); }
  • 77. Browser Supported Firefox 3.6, 4 Yes Safari 4, 5 Yes Chrome 9, 10 Yes Opera 10, 11 Yes IE 6, 7, 8 No IE 9 Yes
  • 78. Why use HSL or HSLA?
  • 79. From the browsers point of view, there is no difference between values defined in RGBA or HSLA.
  • 80. Some designers find it easier to choose and adjust colors using HSLA.
  • 82. CSS1 and CSS2 defined the initial value of the ‘border- color’ property to be “the value of the ‘color’ property” . However, there is no corresponding keyword.
  • 83. We had no way of specifying a border-color to match the color. p { color: red; border-width: 1px; border-style: solid; border-color: “the value of the ‘color’ property”; }
  • 84. CSS3 allows us to the currentColor keyword for this: p { color: red; border-width: 1px; border-style: solid; border-color: currentColor; }
  • 85. Browser Supported Firefox 3.6, 4 Yes Safari 4, 5 Yes Chrome 8, 9, 10 Yes Opera 11 Yes IE 6, 7, 8 No IE 9 Yes
  • 87. CSS1 introduced the ‘transparent’ value for the background-color property.
  • 88. CSS2 allowed the ‘transparent’ value to be applied to the ‘border- color’ property.
  • 89. CSS3 allows the ‘transparent’ keyword to be applied to any properties that accepts a ‘color’ value. p { color: transparent; }
  • 90. Browser Supported Firefox 3.6, 4 Yes Safari 4, 5 Yes Chrome 9, 10 Yes Opera 10, 11 Yes IE 6, 7, 8 No IE 9 Yes
  • 91. Russ Weakley Max Design Site: maxdesign.com.au Twitter: twitter.com/russmaxdesign Slideshare: slideshare.net/maxdesign Linkedin: linkedin.com/in/russweakley