Download presentation
Presentation is loading. Please wait.
Published byDorcas James Modified over 9 years ago
1
CSS The Definitive Guide Chapter 9
2
As has been stressed in CIS 131 or your initial learning of HTML5 “Planning” is important! It is even more true when working with colors. Things to think about when thinking about colors: If you use too many colors will it overwhelm the user? If you change the default hyperlinks colors, will it confuse the user? Will color scheme make it difficult for the user to read?
3
Used properly color can really strengthen the presentation of a document.
4
When many people first start building their Web pages, they create pages in colors that they like. If you're lucky or have a good eye, you'll end up with colors that look nice together. But it's very easy to set up a color scheme that clashes and is difficult for your readers to view for long periods or at all. The primary colors are RED, YELLOW, and BLUE. These colors, in traditional color theory, cannot be formed by mixing any other color. All other colors are derived by combinations of these colors.
5
Secondary colors are ORANGE, GREEN, and PURPLE. These colors are the combination of red and yellow (orange), yellow and blue (green), and blue and red (purple).
6
Tertiary colors are YELLOW-ORANGE, RED-ORANGE, RED-PURPLE, BLUE-PURPLE, BLUE-GREEN, and YELLOW-GREEN. These are the combinations of the secondary colors.
7
Understanding color theory will help you to understand how color works on Web pages. And one of the first places to start learning color theory is with the color wheel. Sir Isaac Newton first put together a circular diagram of colors in 1666. This color wheel allows you to see groupings of colors that are harmonious together and other colors that might clash.
8
Complementary colors are those colors that are opposite one another on the color wheel. By using colors that are opposite one another, you create color schemes that have high contrast and so are brighter and more vivid. Some contrasting colors are: red and green or blue and orange.
9
On display screens, the foreground consists of the characters and pictures that appear on the screen. The background is the uniform canvas behind the characters and pictures. Lets try the “Test Page”“Test Page”
10
Color symbolism by culture If you use color on your Web site, then you should be aware of how your audience views those colors. This is especially important if you are designing a site that is intended for an audience of a different culture than your own (or a global audience). The cultural basis for color symbolism can be very powerful, and if you don't understand what you're saying with your colors, you can make big mistakes.
11
RED China : Good luck, celebration, summoning Cherokees: Success, triumph India: Purity South Africa : Color of mourning Russia : Bolsheviks and Communism Eastern : Worn by brides Western : Excitement, danger, love, passion, stop, Christmas (with green
12
Orange Ireland: Religious (Protestants) Western: Halloween (with black), creativity, autumn Yellow China: Nourishing Egypt: Color of mourning Japan: Courage India: Merchants Western: Hope, hazards, coward
13
There are two ways to directly affect the foreground color of an element: by using the color property and by setting the border colors using one of a number of properties. Example of coding: p.warn {color: red; } (using a class of warn to each warning paragraph and making it red.
14
There are many uses for color, the most basic of which is to replace the HTML 2.2 body attributes text, link, alink and vlink. HTML that uses body attributes. CSS that replaces above html code. Body {color: black;} A:link {color: #808080;} A:active {color: silver;} A:visted {color: #333333;}
15
Changing the color of a border around an image: by using color or border-color img.type1 {color: gray; border-style: solid;} or Img.type2 {border-color: gray; border-style: solid;}
16
Example of coding for form elements: Select {color: rgb(33%, 33% 33%);} Input {color: gray;}
17
The background area of an element consists of all of the space behind the foreground to the outer edge of the borders or the content box and the padding are all part of the element’s background and the borders are drawn on top of the background.
18
Declaring a color for the background of an elements use background-color. P {background-color: gray; padding: 10px;} Adding padding of 10px will let the color extend a little bit from the text.
21
Background color can be set for just about any element Background-color is not inherited Default value is transparent
22
body {color: black; background-color: white;} h1,h2 {color: yellow; background-color: rgb90,51,0);} p {color: #555;} a:link {color: black; background-color: silver;} a:visted {color: gray; background-color: white;} Try some of your own!
23
Coding for having an image in the background. This coding will also tile the image onto the page. Body {background-image; url(bg23.gif);}
24
Please look at page 261 thru 266 Background positioning: Background-repeat: repeat-y Will put the image vertically along the y axis Background-repeat: repeat-x Will put the image along the x axis
25
Don’t want to repeat the background image at all. Use the value no-repeat Background-repeat: no-repeat; 1) Open up your web site and find a small image where you could place an image vertically or horizontally. 2) Now place a bigger image somewhere in your pages using no-repeat.
26
It is possible to change the image’s position in the background such as centering an image or placing it on the bottom or top or right etc. Go to your web site again and add the code to place an image in the center. (see page 264-267 for reference)
27
Using the property background-attachment, you can declare the origin image to be fixed with respect to the viewing area and therefore immune to the effects of scrolling. background-attachment: fixed; In a web browser the viewing area can change as the user resizes the browser’s window. This causes the background’s origin image to shift position as the window changes sizes. Look at examples on page 276 – 277.
28
When a background image has been fixed, it is positioned with respect to the viewing area, not the element that contains it.
29
Please apply a background color to at least one paragraph somewhere on your site that makes sense. Please apply a background image to an inline element in a paragraph of your choice. Please incorporate an image of your choice on a page of your web site to the page background. (this must be a different/or an additional image from what was previously done in class) Please provide comment codes that include today’s date and what you have included.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.