Applying CSS3 text effects
Video: Applying CSS3 text effectsAdding shadows to text and other elements is a solid way to literally make them stand out. Before the CSS3, Text Shadow property gained a significant browser support it has, the only way to create text with a shadow was with a graphics program. Now, text shadows are readily available via CSS, and they open the door to a wide range of effects. In this video I'll show you two; how to create the standard drop shadow effect, as well as letterpress text. Let me show you where we're going first.
- 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
Applying CSS3 text effects
Adding shadows to text and other elements is a solid way to literally make them stand out. Before the CSS3, Text Shadow property gained a significant browser support it has, the only way to create text with a shadow was with a graphics program. Now, text shadows are readily available via CSS, and they open the door to a wide range of effects. In this video I'll show you two; how to create the standard drop shadow effect, as well as letterpress text. Let me show you where we're going first.
So the text here, Ojai Olive Company, and the subheading below it that shows the duration of the tour as well as the price, we're going to turn into text like this, where there's a drop shadow added to Ojai Olive Company, and the ability for the text shadow property to take multiple shadows is used to create the letterpress effect you see in the price and duration area. Alright, let's close out our final page, and get to work. So the page I have open here is tour_ details.htm, and that's found in the Chapter 6 > 06_01 folder.
I have my CSS Styles panel open and we're in Current mode. Now, actually the easiest way to enter in text shadow is using the Properties pane of the CSS Styles panel. So let me go ahead and click into Olive Oil Company, my h2 heading there, and you can see I already have a rule set up for that. So I'm just going to go over and add a property. Click on Add Property, and type in text-shadow, and then press Tab. If you're a Dreamweaver CS5 user, you'll need to enter in the values manually.
If however you're a Dreamweaver CS5.5 user, there is an interface that you can use, and I'll show you that in just a moment. To specify the text shadow you'll need to enter in four different values: an X-Offset, a Y-Offset, the Blur radius, and the Color. So in this case we're going to make a rather traditional drop shadow that extends to the right and below. So our offsets are going be 1 pixel. This is the X value. So that's going to start the shadow 1 pixel to the right, and then 1 px for the Y offset, that will start the shadow 1 pixel down, and then the Blur Radius, and this value specifies how large the text shadow should be.
Let's make ours 3 pixels in radius and then finally the color, and for the color I'm going to choose a dark gray, 666 and then just hit Return. Now notice that the drop shadow was applied to both bits of text here. That's fine. We'll do a more specific drop shadow for the duration and price in just a moment. But I wanted to show you, if you're using Dreamweaver CS5.5, how to take advantage of the built-in Edit Interface. So if you click on the Plus button here, the Edit Interface will open up and you can see that you have controls for entering in X-Offset, Y-Offset, the Blur radius, and a standard Color Picker for choosing the color.
Now of course you can modify these values however you want. Let's, for the moment, increase it to let's say 6 and then close it out by just clicking away from it, and you can see a more general shadow appears. Let's tighten that back up by just changing the value from 6 to 3. So now let's move on and do our letterpress effect. One of the cool things I think about the text shadow property is you're not restricted to doing one shadow; you can actually put in as many shadows as you need.
To demonstrate this, let's go in, and I will put my cursor in the duration and price area, and here you see that there is actually a span with the class of tour cost. So when I select that, that CSS rule is displayed in the CSS Styles panel and we're going to go ahead and enter in our text shadow property again, and the first shadow I'm going to specify will be the opposite of the traditional shadow. In other words, it will go up to the top and to the left, instead of to the right and below.
So we do that by using negative values for the offsets. So it's going to be -1 px for the X- Offset, and -1 px for the Y-Offset, and then a slightly darker color than what we have now specified for the text color, which is as you can see here 666. So we'll go with 333. To enter multiple shadows, all you have to do is separate them with a comma. After my comma, I'll put in a more traditional drop shadow of 1 px for the X-Offset, 1 px for the Y-Offset, and because we're going to put in a darker background in just a second, I'm going to make my shadow white.
So I will put in the pound sign, and then fff. Okay, I'll hit Return and you can see a little bit of a change, but you won't see the full effect until you add a background color. So I'll type in background-color, and I want this background color to be a little on the light side, but not completely white. So I'll choose the #CCC value and there you have the final letterpress effect. Whether you're using a single shadow to give your text some depth or multiple shadows to achieve a more elaborate effect, the text shadow property is very easy to use and extremely powerful.
There are currently no FAQs about Typography with CSS in Dreamweaver.