Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
CSS gives Web designers control over the appearance of their web sites by separating the visual presentation from the content. It lets them easily make minor changes to a site or perform a complete overhaul of the design. In CSS Web Site Design, instructor and leading industry expert Eric Meyer reviews the essentials of CSS, including selectors, the cascade, and inheritance. The training also covers how to build effective navigation, how to lay out pages, and how to work with typography, colors, backgrounds, and white space. Using a project-based approach, Eric walks through the process of creating a Web page, while teaching the essentials of CSS along the way. By the end of the training, viewers will have the tools to master professional site design. Exercise files accompany the training videos.
Right, as we've seen earlier in the chapter, there are very simple ways to set foreground color and also a variety of ways to set color in general and five different ways of setting color using any Keywords or Hexadecimal or Decimal, or you know, RGB, those various approaches. So, what we're going to look at in this video, is we're going to look at setting very simple backgrounds. Basically just flat colors, solid background for various elements. You might be used to this, from sort of old school design, where you can say set the background color on the body to something like E3EDC2 and having done that, you end up with sort of a mint tea green background. So nothing unusual there as compared to possible design, which is roughly equivalent to saying body BG color equals whatever, E3EDC2 for example.
Primary difference in CSS between plain old background colors in the markup and old hexadecimal design and during the CSS way is that you're not limited to setting background on the body a few table elements like table cells. You can set a background color for anything. So you could say, the element has an ID of masthead, I'd like to have a background color, whose hexadecimal value is ABD240 and I would like the element with an ID of navlinks, have the background color whose hexadecimal value is 686397. Ok, and having added those two, which I'm going to highlight there.
We can go back to Firefox and reload and there you go, in our web browser we've set the element with the ID of masthead to have a green background, and we set the element with an ID of links to have a sort of a dusty purple background, and that's what happened, very straight forwards and what happens with these background colors is that the color is filled into the entire background area of the element, the content area and the padding and the border area, so wherever that background area is for that element, that's where the background color is going to go. The one place where the background color does not go is into margins and we're going to talk more about margins and padding and border areas in a different chapter, but for now just that's where background color goes.
Now we can continue the trend and say sidebar background color and this one will do as an RGB, RGB value 23%, 24%, 18% in this case and that will fill in the sidebar with this sort of grayish, greenish background color. Now, I'm not making these up of course, these come from the design, the the designer put together for this page.
In fact, one of the reasons that this is a good idea for a designer to do this sort of thing when I'm in charge and if there isn't a designer in charge, then really unfortunate color combinations result. So I'm not just making these up at random, What this does illustrate, of course, is that you're not locked into a single color throughout your entire style sheet. You really only have to stick to a given color value for a given property. So for a given background color, you have to pick one of the various color value types RGB percent, RGB decimal, hexadecimal, and use that, but it's like you have to use hexadecimal all the way through your style sheet or you have to use RGB percentage all the way through your style sheet no matter what. Use what you like best, or use what makes the most sense. If you pulled a few of your values off of the Photoshop color picker and you just, you know, selected the hexadecimal value at the bottom, copied it, pasted it in your style sheet and then somewhere else you knew you wanted a certain percentage combination of RGB colors, not a problem. If you want to go through the effort of converting them all to be consistent, you can do that to, its up to you. Now, one of the fun things you can do, I'm going to set a background color for the h3s, the headings in the sidebar, this is going to be 155, 150, 202, which is sort of a pretty light dusty purple, sort of thing. Ok, so that's the color that we're going to use for that h3s here, which is the tea that day and post archive, but, you can also use background colors in sort of creative ways to create what are effectively optical illusions, I mean optical but they are still illusions. So, should I say RGB 227, 237, 194, let's see what we have it for, I hit Reload and hey, we get that, it looks like I've punched pieces out of the sidebar and let the bodies background color show through. that's not what I did, I actually set the h3 backgrounds to have exactly the same color as the body and so these sort of lead together in a sense.
The eye can't distinguish where one ends and the other begins, because they have exactly the same color and they have exactly the same color because 227, 237, 194 is the RGB decimal equivalent of E3EDC2. This hexadecimal value, is exactly the same as this decimal value. Maybe we don't want to do that, maybe we want to go back to our late dusty purple, so I'll just set them back to 155, 150, 202, and if you watch carefully the tee of the day and the post archives when I hit Reload ding, there you go, that's what this h3 backgrounds are, just that before I happened to be filling them in with the same solid color that the body uses, now I'm using a different color. So just, you know, a little tip, sometimes you can use two different elements background, to sort of join them together visually.
And you can use your imagination as to what sort of effects would be possible there and this was just one. So that shows us how to use simple background colors and in the next few videos, we're going to look at how to add images to backgrounds and do interesting fun things with them.
There are currently no FAQs about CSS Web Site Design.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.