Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Embracing a Web standards-based approach to Web design means designing your pages to give as much control to the user as you can, while maintaining the integrity of your original design. Remember, your users might be using different browser Agents, hand-held devices, or they may have accessibility issues that require the default font size to be set a little higher than normal. Without a doubt, one of the challenges in Web design is anticipating how your users will be accessing your site. By using relative units of measurement when sizing text, you control how elements relate to each other relative to size, but leave the ultimate control of the text size to the user or the user agent.
This helps your site become more accessible and more readable across a wider array of devices. We'll accomplish this in our Explore California site by first sizing the body tag to a baseline size for our site, and then using ems to size our text relative to the value sent into the page from the body tag. Since the font size property of parent elements is inherited by the elements inside of it, we should be able to control the sizing of our fonts with relatively few styles. So here I have the resources.htm open.
Now, this is interesting. If I click inside my headline here, Got questions, and I bring up my Code Navigator, remember that's Alt+Click or Command+Option+Click on the Mac. If I start at the very first rule and just sort of work my way up, I notice something. Nowhere along this list is anything said about font sizing. Um-huh, Interesting! Let's try our paragraph, same thing. I am not getting any font sizing. Okay, so if we are not getting any font sizing, why are they different sizes? Why is the headline bigger than the paragraph, for example? Well, that's because every single user agent out there has its own default style sheet.
So headings already have sort of the default style sheet within a browser. Paragraphs already have a default size within a browser. That's what you are going to get if you don't explicitly set a sizing for your fonts within your page. So you need to be aware of that as well. Okay. Let's go over to our CSS Styles panel. What I am going to do is collapse my Files panel just to give myself a little bit more room. I can change these dividing lines, so that I can see more of one area versus the other if you'd like. Make sure you're in the All Styles area and select the body tag.
We are going to go ahead and add a property here, and you can do that simply by clicking that link. I find this to be the easiest and fastest way to edit your style sheets. So I am going to click right in there. I am going to type in font, so just the shorthand notation font. I am going to hit Tab. That's going to take me over to the other side. We have to do this in a specific order here. I am going to type in 100% Georgia, "Times New Roman" here. Make sure those are all capitalized the T, the N and the R.
Another Quotation Mark, Times, serif, lower case, and then just hit Return. So as you can see, I really like to hand-code. I just like to type stuff in. You certainly could have double-clicked the body selector typed 100% here, and grabbed Georgia, "Times New Roman" Times and serif from the pulldown menu. That would work just as well. Okay, so a few things changed here. Did you notice how the paragraph seems to get a little larger in relation to the headlines? So what we are doing now is we are basically telling any user agent, "Hey! "Whatever your default size is, that's what we want for all our elements inside the page.
"So make the paragraph the size you'd normally make them, make the headings the size you'd normally make them." Well, that's fine. But now we can take a more granular level of control over these elements. We are going to focus first on our headlines. So the first thing I am going to do is go over to my CSS Styles panel. Scroll down until we find # mainContent #mainArticle h1. So that's the selector you are looking for, #mainContent #mainArticle h1. That's going to target this little guy right there.
So I am going to click on that to highlight it. I am going to add a property here. Here, we are going to add font-size, so font-size. Hit Tab to move over to the Values pane. Here we are just going to type in 2em. If you want, you can just type in the number 2 and then follow directly by an em. You don't have to grab it from the unit of measurement pulldown menu to the right of it. I am going to hit Return. It's going to resize our headings. You might not notice any huge changes right now. All right. Well, if I scroll down the page, here are my h2s.
Just underneath the selector that we just set, we will find the #mainContent #mainArticle h2. Go ahead and highlight that. We are going to add font-size to that as well, so, font-size. Yes, you can grab that from the pulldown menu if you don't feel like typing that in. Then I am going to do on 1.6ems, hit Return. It got a little larger. I mean I don't know if you can't see that, but it got a little bit bigger. Then finally, I am going to find that #mainContent #mainArticle h3, add a Property to it, and change its font size to 1.3ems.
It definitely got a little bigger there. Perfect. Now, what about our paragraphs? Well, I would like our paragraphs to be the normal size of a paragraph within that user agent. Now, I could go ahead and set that explicitly to say 1em or even 100%. But truth be told, because I told my body tag to be 100%, that's going to be inherited by everybody, and that tells my paragraphs, "Hey! Just go ahead and been a default size." In that instance, we really don't need to set any type of sizing for the paragraph at all. So what we did on the body tag has saved us a little bit of time.
Okay, now if we were to preview this in a browser, and I think we'll go ahead and do that. So I am just going to do Save All, Preview in our browser. All of our headlines and paragraphs are relating to each other based on that sizing information. Now, you know that we can increase or decrease the size of the text within our browser. As a matter of fact, for Firefox, if we go into the Zoom, notice that we have Ctrl+Plus and Ctrl+Minus. We can even set it to Only Zoom The Text. I am going to do that. I am just going to say OK. I just want you to Zoom Text Only.
Now, if I do a Ctrl+Plus or Command+ Plus on the Mac, you'll notice my text goes up or goes down. But did you notice how the sizing remains relative? They have the same relation to each other, even as they are larger or smaller. That's because of the fact that we are using those relative units of measurement. Now, you don't need to preview that within your browser. In CS5, we can now actually preview this directly within Dreamweaver. Let me show you what I mean. I am going to go back in the Dreamweaver, and I am going to right-click my Document toolbar.
There is a little toolbar called the Style Rendering toolbar. I am going to go ahead and open that up. This has gotten a little beefier in CS5. You'll notice on the PC, I am moving this around, but you can't move this around on the Mac. Okay, so what does this toolbar allow us to do? Well, the first section in the toolbar allows us to turn on specific media styles. So if you want to look at your Print Style Sheets, which we really don't have any, but if you had some defined, you can click on that and you would see those instead of your Screen Media Type. We'll also have a very quick way right here to toggle your styles on and off.
So just clicking that will disable them. Clicking on that again will turn that back on again, so that you can preview them. We'll also have pseudo-selectors like Length, Visit, Hover and Active. Very useful, if you have links that have different selectors based on whether somebody is these hovering over them. We will be doing that a little bit later on. Then we have this selection. I want you guys to pay close attention to this. This is new as well. I like this. We can Increase the Text Size or Decrease the Text Size directly here in Dreamweaver. So if you really want to see what this is going to look like when somebody increases the text size or decreases the text size, you can just sort of click these buttons until you get what you are looking for, which is really cool.
Now, this doesn't work with Live View turned on. So if you turn Live View on, this is all going to be disabled. This needs to work within the context of your regular Design view. Now, you are also going to notice there is a little button right in the middle that says Reset Text Size. So let's say you have increased and decreased a little bit, and you can't remember what the size actually is supposed to look like. You can just click that and say Reset Text Size, and it will take you back to where you are supposed to be. If it's grayed out, that should mean that your font sizing is at 100%, but I've noticed that to be a little buggy here and there.
So sometimes it will appear grayed out, sometime it won't, but just click that, and it will reset your text right back to 100%. Now, one more thing: While we have used the resources.htm page to help us format our font-sizes, we know that because we are using an External Style Sheet, that our styles are now being used throughout the site. If we've planned properly and structured our pages well, the rest of our site should use these rules without us having to do any modifications. So there you have it. Our site's font-sizing is well defined.
It draws its initial value from the user's default font size, and then any scaling is done in relation to that value.
Get unlimited access to all courses for just $25/month.Become a member
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.
Your file was successfully uploaded.