Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Styling the header and links

From: Preparing CMS Web Graphics and Layouts Using Open Source Tools

Video: Styling the header and links

Now it is time to take our content area and clean it up a little bit so it doesn't look quite so much like the browser default. In our comp for this particular design our headings were shown to be in a different font than Arial. They were shown to be in Georgia. So we are going to need to convert all of our headings to Georgia and assign them the correct colors. We will also want to style the links that you see here in our sample text. So we are going to go to CSS because once again those are all CSS problems and we are going to create a new style.

Styling the header and links

Now it is time to take our content area and clean it up a little bit so it doesn't look quite so much like the browser default. In our comp for this particular design our headings were shown to be in a different font than Arial. They were shown to be in Georgia. So we are going to need to convert all of our headings to Georgia and assign them the correct colors. We will also want to style the links that you see here in our sample text. So we are going to go to CSS because once again those are all CSS problems and we are going to create a new style.

This new style I am going to start by creating h1,h2,h3. In other words it is a style that will apply to all three of my heading tags and we will say Create Style rule. In this case all of them need to be in Georgia, so I am going to take my text and I am going to use the custom font family of Georgia, Times, and Serif, and see how that's changed my headings here to have that Serif, Georgia Heading.

The reason why I have combined header 1, 2 and 3 in a single style like this is so that if I ever decide that I don't want to use Georgia and I want to use something else like Times or something else entirely like Trebuchet, I can easily go in and make one change and have all of the headings affected at once. The next thing I want to do is style each one of the headers individually because each one is a different color. So I am going to make a new style rule and this will be specifically for h1 and I will move the box so you can see what's going on.

Under Text, I am going to set my color to 8aa635, which is the green color we have been using on the site, and the size looks a little chunky to me so I am going to set it to 1.7 ems which looks a little bit better. That will wind up being the title of my particular article. Next I want to create another style. This one is going to be h2. The text color for this one is going to be blue instead of green so that is 38add6 and I am going to make size for this one a little bit smaller too.

It's almost the same size as Heading 1. So this will be 1.4 ems. The other thing I would like to do with the Headings 2 and 3 is to tighten up the space here between the heading and the text underneath. To do that I am going to go to Box and I am going to set the bottom margin to 0. Notice that the space doesn't totally go away. That's because the paragraph also has a margin on its top, which is keeping that space open. I'll need to create another style for the paragraph to get rid of the space in between the heading and the paragraph.

Finally I am going to create a style for h3, and for h3, I am just going to change the color to green, which is 8aa635, and I am going to set the margin at the bottom to 0 as well. The last thing I need to do is create the paragraph style with a margin on the top to 0. That will tighten up the space between Heading 2 and Heading 3 and the paragraphs underneath them.

So finally one last style which will be the paragraph and we are going to set its top margin to 0. See how the text tightens up nicely right away? Now as I have been creating these styles, they have been put at the bottom of my list of styles in my stylesheet. I'd like to collect all of these generic HTML tag type styles together at the top of the stylesheet so that the more specific items like these things with IDs can override those HTML settings later on if necessary.

So I am going to use the little arrow key here at the top to move the style up the list. I just have to click on it and then keep clicking the arrow button until it goes where I want it to go to reorder things. All right and I am going to say OK so we can take a good look at our page. You can see our Heading 3 and our Heading 2 and Heading 1 are visually distinct. They're different colors in some cases, there is a little bit of difference in spacing. So the last thing I need to do here is style these links, which are the default unvisited blue that you would see in your web browser.

I would like to make them the prettier blue, the same color as the Heading 2. My visited links I am going to make green. The same as the Heading 1 and the Heading 3 and I will also set a hover state. So back to the CSS, I am going to make new style this one will be called a:link and I will nudge that up the list. That color is going to be our blue, which is 38add6.

Then I am going to create my visited link. a:visited. Remember to create these in the right order. You must always create your link first, followed by the visited state, followed by the hover state, followed by the active state of the link. LVHA and you can remember that because you "love to hate" CSS. Typically I don't write active states for my style sheets anymore. The active state was the state after you had clicked the link before the next page had loaded.

But with lightening fast Internet access these days and quick web browsers we almost never see the active state of the link anymore. So I've gotten a little bit lazy and I don't really write an active state anymore. I just write the link, the visited and the hover. But if you would like to write an active state, by all means go ahead and do so. So for my visited link I am going to set its color to 8aa635, which is our green, and finally I am going to create a new style rule for the hover, a:hover, and that is going to be our blue again. So that will be 38add6.

And this time for the hover state, I'd like to turn off the underline. So I am going to say no for the text decoration and we will need to move that up with our other links there in the stylesheet, okay. I am going to go ahead and save this and I am going to preview in the browser, because we are coming right along here. To do all I am going to do is click the Browse icon up here in the top navigation bar for the website and you will see that the website is coming along very well.

When I roll over the links, the underline goes away, which is wonderful, and things are lining up nicely for the most part. The next thing I am going to work on is the navigation bar, which clearly needs a little work. We need some navigation items and we need to make them functional.

Show transcript

This video is part of

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Preparing CMS Web Graphics and Layouts Using Open Source Tools.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.