Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Definition Lists are too often ignored for the workhorses they can be and the problem is all in the name. Not every web designer is given the mandate to include a series of definitions in every site they create, but how many times have you had to create an FAQ? Definition Lists are the perfect vehicle for your frequently asked questions. In this video I'll show you how to turn a series of question and answer paragraphs into a stylish FAQ. So I have open here the faq.htm file from the Chapter 8 > 08_03 folder and we're in Design view.
So scroll down to right below a Backpack California, and I'll scroll up just a little bit to explain the structure of this page. Eventually, what will happen here is all of these main categories will include separate FAQs. So I'm just working with the first one here called Backpack Cal and let me scroll back down to where that is. As you can see there is a series of paragraphs, where the first paragraph is a question and the second paragraph is an answer; pretty straightforward in terms of FAQ.
So the first thing we're going to do to turn this into a Definition List is select all the text that is included in these paragraphs. So that will include all of the text down to We appreciate your understanding and now I'm going to add in the necessary tag to identify this as a Definition List. Now you can find this in a number of ways in Dreamweaver. Let's open up the Insert panel and then switch to the Text category and if you scroll down the Text category and go all the way down to the bottom, you'll see three definition related tags.
The first is the one we need, Definition List. This is the overall encompassing container much like Ordered List and Unordered List. So instead of a ul or ol tag, when I click Definition List, it will wrap my paragraphs with a dl tag. Now as you can see what it did was just basically collapse the paragraphs and gave a little bit of styling where it indented alternate paragraphs, but look what happens when we click into the tag.
The first paragraph is wrapped with a definition term or dt tag, whereas the second paragraph has a definition description or dd tag. Now Dreamweaver does this all automatically when you have a series of paragraphs that alternate in a question and answer format. So it makes it very, very easy for you to apply a Definition List to an entire long series. One caveat though, you need to do this in Design view. If you try to do this in Code view it won't work and you'll have to manually make those changes.
So now let's do some styling. We're going to create three different rules; one for each of the Definition List related tags. Let's start with Definition List itself. So I'll select out of the Tag Selector and then go over to the CSS Styles panel and click on New CSS Rule and let's make this a little bit less specific just so we have mainContent, mainArticle dl. Click OK. The first thing we're going to do is adjust the margin and padding. So let's go to the Box category, deselect the Padding and Margin and same for all, and then let's just add in a 1 Em of margin for both the Padding Bottom and the Margin Bottom.
Next, we also want to add a little bit of a border here, so it will separate the Definition List FAQ from the rest of the page. So go to Border and deselect the Same for all under each of the categories, and under Border Bottom Style choose solid, under Width enter in 1 pixel, and then for the Color let's choose medium gray 999, okay. I'll click on that and you won't see a whole lot of change there.
There you can see my border appear. Now let's go to the definition term, which is basically the question in our FAQ. So I'll highlight dt from the Tag Selector, choose New CSS Rule and again make it less specific, so we can use this wherever on our site, click OK. Now we get to modify the actual font. So I'm going to choose a slightly different font than we have in other places on the page. I'll use Tahoma, Geneva, sans-serif.
Let's make the Font-size .9 ems and let's make it bold. It is the question, after all. Finally, let's change the color and we'll go for a darker gray here. Now I want to space it just a little bit so it stands out. So I'll go to Block and under Letter-spacing put in 1, in this case I'm going use pixel. Finally, we need to adjust the Padding and Margin. So we'll go to the Box category for that and under Padding just put in 0, with the Same for all selected so that will be applied all round.
Deselect the Same for all under Margin. So on the Top margin we'll make that 1 em, on the Right it will be 0, Bottom will be 0.5 Em and Left will be 0. Okay, let's see what that results in. So good, as you can see we get a little separation here. It stands out a little bit, because we have a little additional letter spacing and overall it looks pretty good. So, our final one to tackle is the definition description.
I'll put my cursor in the first one and then select dd tag there. One more New CSS Rule and click Less Specific a couple of times. Now click OK. I'm going to make sure that the font size is the same as the question; .9 ems. I'm going to add a little separation here, because our answers tend to be a little bit long. So let's go ahead and make the Line-height 1.4 ems. We'll keep the same color, the darker gray.
Now to make it standout just a bit why don't we go ahead and justify the text, and for that you'll need to go to the Block category and under Text-align choose justify. To the Box category now to handle the Margins and Padding. Margins we'll just zero out. Click the Same for all check box to clear that under padding and all we really want to do is put in a 2 em padding on the left. Alright, let's click OK and there we have our final presentation.
Now let's go into Live view just to verify that it looks as good as we hope it does. There you can see the justified text and the site consistent styling. Definition List can be brought into play whenever you have a collection of name/value pairs, like question and answer or a series of web site links and their associated descriptions.
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.