csu - dce 0715 - introduction to css css colors - fort collins, co copyright © xtr systems, llc...
TRANSCRIPT
![Page 1: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/1.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
CascadingStyle Sheets -
Specifying Color
Instructor: Joseph DiVerdi, Ph.D., M.B.A.
![Page 2: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/2.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Specifying Colors
• Several Methods for Specifying Color• Identical to HTML Methods• Caveat:
– CSS is not a precise layout language– HTML is not a precise layout language– There are unavoidable differences among OSes– There are unavoidable differences among
browsers– With this information you'll be able to do the best
work possible
![Page 3: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/3.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Specifying Colors
• Borders, Text, & Backgrounds can possess color specifications
• Color Specification Methods:– Named Colors (aka Color Keywords)– RGB Colors -
• Using Decimal Numbers• Using Percentages• Using Hexadecimal Numbers• Using Short Hexadecimal Numbers
![Page 4: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/4.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Named Colors
• Named Color Choices:
aqua black blue fuschia
gray green lime maroon
navy olive purple red
silver teal white yellow
• The Original Windows VGA Color Set
![Page 5: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/5.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Named Colors
• There are no exactly defined RGB values for these keywords– It is Up To Browser Developers to Decide What
They Might Mean– It is Up to BIOS Developers to Decide What They
Might Mean– It is Up to Monitor Developers to Decide What
They Might Mean
![Page 6: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/6.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
RGB Colors
• Several equivalent number systems– Percentage: 0-100%– Decimal Number: 0-255– Hexadecimal Number: 00-FF– Short Hexadecimal Number: 0-F
• All schemes deconstruct every possible color into varying amounts of Additive Primaries– Red, Green, & Blue
• Each scheme uses a different numbering scheme to define the amounts
![Page 7: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/7.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
RGB Colors
![Page 8: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/8.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
RGB Colors
• Percentages:– 0-100% Red– 0-100% Green– 0-100% Blue
• Syntax:H1 { color: rgb( 20%, 20%, 20%); } /* dark gray */H2 { color: rgb(100%, 0%, 0%); } /* red */H3 { color: rgb(100%, 40%, 0%); } /* orange */H4 { color: rgb(100%, 100%, 0%); } /* yellow */H5 { color: rgb( 0%, 100%, 0%); } /* green */H6 { color: rgb(100%, 0%, 100%); } /* purple */
H6 { color: rgb(rrr, ggg, bbb); }
![Page 9: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/9.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
RGB Colors
• Decimal Numbers:– 0-255 Red– 0-255 Green– 0-255 Blue
• Syntax:H1 { color: rgb( 51, 51, 51); } /* dark gray */H2 { color: rgb(255, 0, 0); } /* red */H3 { color: rgb(255, 102, 0); } /* orange */H4 { color: rgb(255, 255, 0); } /* yellow */H5 { color: rgb( 0, 255, 0); } /* green */H6 { color: rgb(255, 0, 255); } /* purple */
H6 { color: rgb(rrr, ggg, bbb); }
![Page 10: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/10.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
RGB Colors
• Hexadecimal Numbers:– 00-FF Red– 00-FF Green– 00-FF Blue
• Syntax:H1 { color: #333333; } /* dark gray */H2 { color: #FF0000; } /* red */H3 { color: #FF6600; } /* orange */H4 { color: #FFFF00; } /* yellow */H5 { color: #00FF00; } /* green */H6 { color: #FF00FF; } /* purple */
H1 { color: #rrggbb; }
![Page 11: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/11.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
RGB Colors
• Short Hexadecimal Numbers:– 0-F Red– 0-F Green– 0-F Blue
• Syntax:H1 { color: #333; } /* dark gray */H2 { color: #F00; } /* red */H3 { color: #F60; } /* orange */H4 { color: #FF0; } /* yellow */H5 { color: #0F0; } /* green */H6 { color: #F0F; } /* purple */
H1 { color: #rgb; }
![Page 12: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/12.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Color Problems
• Colors vary across different OSes & Browsers• Restricting color choices to so-called Web
Safe Colors increases the consistency of results
• Web Safe Colors– multiples of 20% 0, 20, 40, 60, 80, 100%
– multiples of 5110 0, 51, 102, 153, 204, 255
– multiples of 3316 00, 33, 66, 99, CC, FF
– multiples of 316 0, 3, 6, 9, C, F
![Page 13: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/13.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Color Effected Properties
• background-color sets background color of element
• border-color sets foreground color of overall border of
element• color sets foreground color of
element
![Page 14: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/14.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Specifying Body Colors
• BODY tag accepts several color attributes– text color– background color (or image)– link
• unvisited or not yet followed
– active (link)• depressed mouse cursor
– visited (link)• been there, done that, got the T-shirt, saw the movie...
• CSS properties can be used to replace these attributes
![Page 15: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/15.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Specifying Body Colors
BODY {
color: black;
background-color: white;
}
A:LINK {
color: red;
}
A:VISITED {
color: purple;
}
A:ACTIVE {
color: blue;
}
![Page 16: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/16.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Specifying Body Colors
BODY { color: black; background-color: white; }
A:link { color: red; }
A.external:link { color: green; }
A:visited { color: purple; }
A.external:visited { color: aqua; }
A:active { color: blue; }
<A CLASS= external HREF="...">...</A>
<A HREF="...">...</A>
![Page 17: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/17.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Specifying Element Colors
• Each element can have foreground and background colors specified
• It is also possible to specify "transparent" to allow the BODY background to show
• Transparent is the default
H1 { color: black; background-color: white; }
H1 { color: black; background-color: transparent; }
![Page 18: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/18.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Example
BODY {
background-color: aqua;
color: black;
}
A {
background-color: transparent;
color: blue;
}
H1 {
background-color: rgb(255, 100%, 255);
color: rgb(100%, 0%, 0%);
}
![Page 19: CSU - DCE 0715 - Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph](https://reader036.vdocuments.us/reader036/viewer/2022082506/5697bfd31a28abf838cac30d/html5/thumbnails/19.jpg)
CSU - DCE 0715 - Introduction to CSSCSS Colors - Fort Collins, CO
Copyright © XTR Systems, LLC
Personal Web Pages
• Apply these methods to your Web Site• Modify your style sheet to apply each method
to some element• Verify that each method works in your hands