Defining and changing type with the CSS Rule Definition dialog
Video: Defining and changing type with the CSS Rule Definition dialogThe CSS Rule Definition dialog is useful for both creating and modifying CSS rules to style text, CSS rules to style text, especially if you'd prefer not to write out the CSS code yourself. The dialog is organized by categories and virtually every one of them can be used for styling text. I have open here the mission.htm file from Chapter 1 > 01_03 folder, and before we begin our exploration of the CSS Rule Definition dialog box, I just want to point out that there are like many of Dreamweaver's interfaces, several ways to expose it.
- Next steps
Viewers: in countries Watching now:
Dive deep into key typographic concepts and learn how to manipulate type in Dreamweaver. Author Joseph Lowery introduces Dreamweaver type tools and shows how to perform basic text modifications, establish the appropriate type unit, integrate custom web fonts, and apply drop shadows, gradients, and other effects. The course also provides in-depth tutorials on structuring text with headings, paragraphs, columns, and lists, and offers a preview of Adobe's proposed CSS Regions.
- Modifying type in the CSS Styles panel
- Understanding the different type measurement unit options
- Allowing users to set page type size
- Employing web-safe fonts
- Exploring CSS 3 typeface options
- Setting up @font-face
- Applying color and transparency to type
- Styling the font weight, case, and letter spacing
- Inserting drop caps
- Rotating text with CSS transform
- Laying out text in multiple columns
- Incorporating ordered and unordered lists
- Targeting lists items with the nth-child selector
Defining and changing type with the CSS Rule Definition dialog
The CSS Rule Definition dialog is useful for both creating and modifying CSS rules to style text, CSS rules to style text, especially if you'd prefer not to write out the CSS code yourself. The dialog is organized by categories and virtually every one of them can be used for styling text. I have open here the mission.htm file from Chapter 1 > 01_03 folder, and before we begin our exploration of the CSS Rule Definition dialog box, I just want to point out that there are like many of Dreamweaver's interfaces, several ways to expose it.
One way to get into it is to go in through the Property Inspector. Another technique is to go in through the CSS STYLES panel, whether you're creating a new rule or editing an existing one. Let's take a look at the Property Inspector route. So I'm going to go down to where my callouts are, and I'll select this text here, the Day Spa Package. Note that this text does have a Targeted Rule and you can see it listed here; it is #sidebar #specials p. So we're going to go ahead and make changes to that, but we're going to make some changes that aren't on the Property Inspector.
So to do that, we'll click Edit Rule. Then the CSS Rule Definition dialog box opens up. Notice that the title has been customized and includes the rule as well as where it's located. So we'll start out in the Type category and you can see what properties are already applied. Here in the Font-style property, the italic value has been applied. So I'm going to go ahead and get rid of that by changing it to normal. And let's say I want to change the color of the text, so I'll open up the Color Picker and I'm going to sample the background color here, just so it ties in with our design.
Now the next category that has a lot of text controls on it is the Block category. Here you can control Word-spacing, Letter-spacing, the Vertical-alignment, the standard horizontal alignment, and then also Text-indent, White-space, and how the element displays, whether as a block or an inline element. Now if I wanted to change the text alignment for example, I would just open up the list here and I could choose from any of the four available options: left, right, center, or justify. Let's go ahead and just keep it right justified; that seems to fit with this design.
Next, let's go to the Box category. This is where you can control the Padding and Margin of an element. Here we can see that the Margin is set to 0.5 ems for the Top and the Bottom. Let's increase that just a little bit, and I'll make those 0.8. Now if I wanted to add a border to my text, I would go to the Border category. If I was working with lists, I have the List category, and so on. Alright, let's go ahead and click on OK. And once I deselect the text, you can see my new color and the fact that it dropped down a little bit.
All my new properties have been applied. Of course, with a name like CSS Rule Definition dialog box, obviously you can not only modify existing rules, but define new ones. Here's how you do it. Let's scroll back up and then select the h3 element, "Our goals and how we'll reach them." Now you'll notice in the Property Inspector that there's not one very specific rule that applies to it. The most targeted rule is the one that applies for all the headings and the paragraph tag. So let's create a new one.
We'll open up the Targeted Rule list and choose New CSS Rule. This time when we click Edit Rule, the New CSS Rule dialog box opens up instead of the CSS Definition dialog box. And we're going to switch to the Compound Selector Type, and then Dreamweaver will automatically populate the Selector Name field with the most highly targeted selector it can. Now we don't need it to be quite this targeted, so I'm going to go ahead and click Less Specific a couple times just so that we're in the main header, in an h group, and targeting the h3 tag.
We'll leave our Rule Definition defined in main.css and click OK. So now in the Type category, I'm going to go ahead and select Font-weight normal. h3 tags normally have a Font-weight of bold and I want this to appear a little lighter. I want to also automatically uppercase it all, so I'm going to Text-transform, and once I open up that list, I see that one of the values is uppercase, so I'll select that, and then again, I'm going to sample the blue background.
Okay, so that's what our h3 tag looks like now; let me go ahead and click OK. And you can see how significantly it's changed. Now I can continue to add properties. If I want to go ahead, and let's say Center this, I can just use my Property Inspector here, or I could've gone back into Edit Rule, reopened the CSS Definition dialog box, and then switched to the Block category to choose the Text-align value I wanted.
However, that's a lot more steps than just clicking it on the Property Inspector. So you can use a CSS Rule Definition dialog box in combination with the Property Inspector. You're not locked into one path or another. Now I want to add one more property. To do that, I'm going to click on Edit Rule because this is a little bit more of a complex property. Let's go to the Border category, and we'll add a single border on the bottom. Now to do that, I'll need to deselect each of the Same for all check boxes, and then in the Style, I'll choose solid.
Under Width, we'll put in 1 pixel, and we'll be consistent and select the blue from the background. Alright, let's hit OK, and now I'll go into Live View, and there you can see the final product. Now to save my changes, I'll go up to File and then choose Save All Related Files. This will save the CSS files as well as the source file if necessary. The CSS Rule Definition dialog is really great for writing out your CSS styles without knowing a lick of code.
There are currently no FAQs about Typography with CSS in Dreamweaver.