Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
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.
In this video, we're actually going to start styling table cells. So in our calendar table, each of the days of the week, each of the days of the month I guess is enclosed in it's own table cell and we can style those so they stand out a little more, or so the things line the way that we want or to spread things out or whatever we to do so post-archive td, to select the actual table data cells as opposed to th. We can say border, 1px solid #787A6B which is a color that we pulled from talking with the designer, if we hit Reload, a border gets on every single of those table cells and including obviously the ones that don't have actual days of the month, but there's not a whole of which really get around that cross browser fashion. In fact, if you look down to markup, you'll see that these table cells don't have any actual content and in Internet Explorer for Windows without the content, you're not going to get the table borders. If you want the table borders, you have to put something in each of those, like a nonbreaking space element, ampersand mbsp semicolon, in other browsers by default, cells are styled, whether or not they have content.
The thing is that if you want the empty cells to be styled in every browser you'd have to put in nonbreaking spaces. If you don't then, well, we'll see in a moment. Empty-cells hide, that doesn't work in Internet Explorer for Windows, but it does work in more recent browsers. So if you have a situation where you want your empty cells to not be styled not to show up at all basically like they are here, then you would say empty cells hide and not put anything, no nonbreaking space entity or anything else inside those empty tables, so you would leave them empty, and then you would get this effect. If you want them to show up then you get rid of the empty cells hide, for example Firefox, well you get rid of the empty cells hide in your CSS and then you put nonbreaking spaces into your table cells and then they will show up all nice and pretty. Anyway, we might decide that we'd like a little bit more space inside each of these.
So having done that, we can see that these now are all spread out and they're all very sort of airy and light and taking up a lot of space. Now, we might decided instead that actually we'd like to make sure that there's no padding whatsoever, really get this sort of crunched down. This is less padding than is typically the default. Web browsers usually have a default padding built in for table cells somewhere in the vicinity of two pixels, but again, there's no way to guarantee that every browser will be exactly the same on score.
Like you can say padding zero and get rid of any spacing inside the cells. Now, the space between cells you might think yourself oh hey, I just, I can effect that effect with the margin but that turns out not to be the case. Table cells aren't allowed to have margins. The CSS specification says explicitly that internal table elements, which is actually table rows, table cells, table headers, etc. don't get margins. So if you want to enforce separation between table cells, there are a couple of CSS properties that exist, but again not supported by Internet Explorer for Windows. So instead, you use the cell spacing attribute on the table element. So if you want two pixels of space between your table cells, you say cell spacing equals two and if you want one, you say one and it would be nice if we did have to do that if we can take the cell spacing attribute out and just use CSS, but that's not really practical right now, unless your website never gets any visitors from Internet Explorer for Windows, and hey, if that's the case then get it done.
We may decide here that we'd like to put a little bit of a background for table cells and accompanied by a pretty color. So this will give table cells contents a very dark gray color, not quite so dark gray background, so they will look like that, and then of course as you can see the hyperlinks are due to rule somewhere else in the CSS are said to be white. So they now really stand out.
And the last thing we're going to do here is take care of the fact that contents aren't really, they seem a little weird don't they, they are a little offset. Some cell contents seem to be just fine, and others seem to be sort of jammed over to the left, and that's really because they are all left aligned, and somebody's table cells are wider than others because for example the WED for Wednesday is wider then the FRI for Friday. So what we're going to do is we're going to make these guys center and that will even things up, and sort of obscures the fact, it doesn't totally hide it, but it obscures the fact that each of the columns is, is a different whip, a slightly different width.
Friday and Saturday tend to get a little squished than Tuesday and Wednesday and Thursday. If that particularly bothers you, we could also say something like width 15% and then things will start to even on a little bit more. They will not be precisely equivalent, but they're going to be a lot closer and the reason they may not be precisely equivalent is because honestly the way tables are laid out is a little bit voodoo-ish, it's kind of strange and abnormal. You can't ever be totally certain that you're going to get exactly what you want.
Table cells automatically grow if the content is wider than the defined width of the table cell. Of course, 15 times 7 is 105 and so 14 times 7 would be 98 and so 14% might be a better choice than 15%. But you can see that the table actually got a little bit wider when I went from 15% to 14%. Again, this is, you know, you know the table layout algorithms, are going to be different from one browser to another and they might create vaguely weirdish effects. You can never be quite entirely certain what might happen. So, if you prefer having this more regular column width, then that's great. If you're willing to just let the columns be as wide as they need to be and no wider, then you could just not define the width for your table cells and everything is ok.
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.