Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,987 courses, including more Web and personalized recommendations.Start Your Free Trial Now
- View Offline
As you start to add content to your HTML page, you're going to want to start controlling all the visual aspects of it, and luckily you can do that with cascading style sheets. Well, what are those? Well, they're a style sheet language used to describe the design of an HTML document. Also just called CSS, and with this CSS you can control all these visual aspects of the content, and you can actually have it separate, because the CSS can separate the content from the design. Take for instance an HTML page, you might have the content at the bottom and all the CSS will exist at the top, and that will control all the visual aspects of that HTML page.
But know you can also have those CSS styles external from the HTML page, so you have the external page that you can work on, and it will affect that HTML page that is linking to it. Taking that a step further, you can have that one CSS page, and it could actually affect many different HTML pages, so you can have one CSS file that all the HTML pages are pointing to that affects the entire site. That's great, because I only have to update my CSS in one place, so it's going to be more consistent as well, as well as smaller in file size, because I only have that one reference to the design. Well, what does this CSS look like? Well, it basically consists of a selector and declarations, so these are your CSS rules as they're known, because you have your selector, known as the paragraph tag, in this case the P element, and the declarations, which are basically a property and value combo. So you have your selector and then your declarations.
Now whenever these selectors are used, those declarations will be applied. So, in the context of an HTML page, you might have the paragraph, tags, and when those CSS rules are applied, those properties are applied to that text wherever the paragraph tags are being used. Luckily, Dreamweaver makes styling CSS and using CSS and modifying CSS really easy. In fact, they don't to worry about necessarily dealing with the CSS code, because there are also handy panels that will do a lot of this for me, enabling me to just pick a color if I want to pick a color. Dreamweaver makes this really easy.
So let's go ahead and dive into Dreamweaver now. Here I am in Dreamweaver, I have my web page open, and it's looking pretty good so far, but I really want to tighten this up, and I want more control. And you actually have that control with CSS. In fact, as I take a look, check this out, I don't like how that text runs clear up to the edge of that box. Another thing I like to take a look at doing is maybe making that black semi-transparent. Or what about rounding the corners? Again, a popular thing to do these days.
Also what about adding say a drop shadow to this text, can I do that? And will it require a graphic? Well, no. You can do all of this with CSS. And that's what you'll do, you'll select this, and you'll start to look in the Properties panel and realize that you don't see any of those options down here, okay? So we need to go beyond this Properties panel. In fact, if we go into the CSS Styles panel, select All, this happens to be my section. Okay, this is my section selector, my selector tag, and as I take a look right down here, well, here is all the properties that I currently have added, which are also shown here, but if I just double-click on it--or you can always hit this button right down here for editing that rule, just double-click on it-- now you get the CSS Rule definition for this section.
This is great. I can jump in here to the background, maybe to the box. Okay, this is good. I'm looking in here for this box. That's exactly what it is. I can add padding to it. So, let's add padding of 5 pixels all the way around. Clicking Apply, it adds that padding. Nice, I like that. I can take a look at adding a border, maybe changing the position, all sorts of things, but another thing I mentioned was changing the background to be semi-transparent.
So, you might look in here and take a look at all these various colors that you can select, and really what I want to do is I want to go beyond these colors by selecting the flyout menu here, changing the Color Format from the Six-digit Hex colors to red, green, blue, Alpha. Ooh! Alpha is going to be transparency. So will HSLA. So, selecting that RGBA, now look when I select any one of these colors, I get that RGBA, that last number, that number 1, I can change to .5 to make it 50%.
So again, that's that last digit right here, doing it .5, that's going to make that 50%. I'll click Apply. You can see that it made it 50%. All right so that's a little too transparent. I am going to change that to about .8, which is 80%, clicking Apply, and there we have that, that looks good. All right, so far so good. I'm going to save this page. In fact, I can select the Live view, and you can see it in action. It's looking a lot better, but again, I want to round these corners now. Sounds like a great idea.
All right, so, going into that particular item, I can take a look if I double-click on that, I can start to look for it in here, and really there are so many CSS, especially CSS3 properties available these days, it's just going to fill up all of this entire panel. So, what you can do is if I hit Cancel, I can add a property down here. So check this out, adding a property, clicking, oh, look at all of these CSS properties.
Now it's just a few of them, not that many, but you can see this long list, okay. What I want to do is I want to change the border radius. So coming in here, I can select border-radius. Now watch what happens when I select border-radius. Rather than having to type in some numeric values, I get this widget, so I can click Edit. Well, look at this corner radius, I can change that to say 20, okay.
And in fact, if I go to Live view, you can see it already implements that. So again, border-radius was what I was dealing with. Going back in there, I have Live view selected, I can start to not only change it from 20 each side, what if I wanted to do 30, I can see as I type that in, it will actually change it to 30. Let's turn off Same for all and manipulate the Top Left and Bottom Right to be right angles, hitting Enter, and I really like the shape, sharp point there, and then it's going to be kind of hard to see, but down here there is a sharp point there as well.
I love this sort of control, doesn't require graphics, I'm doing it all with CSS. The last thing I want to do is add a text shadow to this element. Now remember this is my h1, okay, so it's turning off that Live view. This happens to be my h1. So for that h1, I can add that property for that text shadow. Again, this panel is going to give you the most robust control, so text-shadow is what I want to select, text-shadow and what I want to do from there is again, use that widget to define the offset of about 5, X and Y, Blur-radius about 5, and let's make that Color, I can change that to black just like that.
Now you don't see it, well, turn on Live view, and you can see there it is. Pops off just fine, and I can even manipulate that some more. Just keep in mind this is the h1, so coming in here I can always change that any way I want, and not only can I change the color, but I can even make it semi-transparent, say .5, hit Enter, and you can see that made it a lot softer. It really makes that kind of pop off the page, which I really like that. So, feel free to play with those numbers, I'll change the Blur-radius to about 10.
I'm liking that more, and in fact, that's what I think I'll leave it at. All in all, the text is going to be more on this side, but I'd say that looks great. Really, with a lot of control I'm able to control the visual elements of this page, everything from the box elements, any of these tags, I can either do that by editing the properties, by clicking on them this way, or even adding the property down here, all with CSS and specific CSS3 properties available.
- Understanding basic web principles
- Adding content to a web page
- Linking to web sites and email addresses
- Styling content with CSS
- Creating a layout that fits multiple browsers and devices
- Building an HTML5 layout
- Inserting images and video
- Adding a menu bar
- Creating a contact form
- Integrating a Twitter feed
- Uploading and testing a web site