Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
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.
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.