New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

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

Adding CSS3 transitions

From: Dreamweaver CS6 Essential Training

Video: Adding CSS3 transitions

Part of being a successful web designer is the ability to create engaging user experiences within the context of your design. User expectations for online experiences have changed dramatically over the years. And designing your sites to meet those expectations increasingly means adding levels of interactivity to your pages. Most interactive elements on the web are driven through JavaScript, CSS or a combination of the two. Depending upon their functionality these elements can become pretty complex. In this chapter, we are going to take a look at ways that you can add this level of complexity to your site through the use of Dreamweaver's visual tools with a minimal experience of JavaScript or advanced CSS features.

Adding CSS3 transitions

Part of being a successful web designer is the ability to create engaging user experiences within the context of your design. User expectations for online experiences have changed dramatically over the years. And designing your sites to meet those expectations increasingly means adding levels of interactivity to your pages. Most interactive elements on the web are driven through JavaScript, CSS or a combination of the two. Depending upon their functionality these elements can become pretty complex. In this chapter, we are going to take a look at ways that you can add this level of complexity to your site through the use of Dreamweaver's visual tools with a minimal experience of JavaScript or advanced CSS features.

We will begin by talking about one of the new features in Dreamweaver CS6 and frankly, it's one of my favorite new features, which is support for CSS3 Transitions. So I have the index.html file open here from the 11_01. And essentially let me show you what I want to do here. I am going to just preview this in one of my browsers. All right, what I would like to do is hover over these particular info boxes and have them expand to show their contents because there is more to these than you can see right now. If we go into Design View for example, you can see that each of these has some text.

So I would really like it to where we are saving a little bit of space but still giving the user the ability to hover over that and read that text and link to the article if they want to read little bit more about it. So to do that, one of the easiest ways to do that now is to use CSS transitions. They allow us through the use of pure CSS, no JavaScript whatsoever to animate certain elements on the page or certain properties of elements I should say. So in this case we are going to animate the property of Height. Now I want show you what it is that we are going to be targeting. Not every single one of these elements needs to animate.

So I have created a class and if I click inside this one you can see it, it is the condense class. So any of these sections that have a class condense applied to it I want to go ahead and sort of expand those and do that particular property animation. Well, now I'm certainly free to go into my CSS Styles and hand code that myself. I could even go over the CSS Styles Panel and it has support for many of the transition properties and if I know the syntax of it and how to do it I could go ahead and construct it through the CSS Styles Panel. But what if I don't know these things or what if I just wanted to do it really quickly.

All right, so what I am going to do is I am going to go up to the Menu and go to Window and I am going to choose CSS Transitions, it's about midway down. Now that brings up my CSS Transitions Panel, and of course you can dock that to anyone of your workspaces if you want to. And what I am going to do is I am just going to click the Plus symbol to create a brand-new transition. Now when I do that, I get the New Transition dialog box, now I am free to go in and type in any rule that I want to target. So if you're in the middle of creating your CSS file and you haven't created the selector yet that you want to target you could go ahead and create it right now if you wanted to.

In this case however, the selector that I want to target or the element that I want to target, that selector is already written. So I am going to grab that pulldown menu and I am going to scroll all the way down, they are more or less in alphabetical order, and I want to find this section condense, so section.condense. And the next thing I have to choose is when I want this to animate, when do I want these properties to animate. Notice that we have several choices here, we can do active, checked, disabled, enabled so you can do this a lot with forms actually, focus, hover, indeterminate, that's a nice one and target.

Now what we are going to do is we are going to do a hover. So when somebody hovers over these. Now if I am going to transition multiple properties I then face with the choice of do I use the same transition, meaning the same speed, duration, easing that sort of thing for all the properties or do I want to do them separately. What if we wanted for example, these to extend in terms of their height and then after they were done animating out change the background color? Well, to do that we would have to use a different transition for all properties. So just to sort of demonstrate we are only going to do one property but just to demonstrate the difference in the way the interface looks only, I am going to use a different transition for each property.

So it changes the interface a little bit, but not in a very large way. So what I am going to do is I need to go down and find the property that I want to change. Let me tell you, you can have the property that we've already set on the section.condense, because there is a two-step process here. Well in section.condense I have a Height value applied to it that's making it a specific height. Now I am actually not using the height property, I am using max-height, so a maximum height. And currently the maximum height of each of those is 308 pixels. So it's sort of saying, even though you have a lot more content in that I am not going to allow you go past 308 pixels.

I am then also telling it that any content that doesn't fit inside there I have an overflow property of hidden and that's going to hide the content so that you can't see it if it doesn't fit within that particular height. Now why am I using max-height instead of height? Well, that has everything to do with some rendering errors or I guess it's actually a problem in the specification to be honest with you, is the specification doesn't support a value for height of auto. So unless each one of these is going to be exactly the same height which it isn't, then I need to use a property like maximum height.

Okay, that's probably way more information than you wanted to know. So what I am going to do here is I am going to click the Plus symbol to go ahead and select one of these properties and of course the property I am looking for is right here max-height. Now once I select a property I need to choose a Duration meaning how long should this animate? Now I am going to type in .5 seconds, although you can use milliseconds if you prefer. For the Delay I am not going to do anything, I don't want there to be any delay of the animation to occur as soon as somebody hovers over this. We have a Timing Function which is basically easing.

Now if you are wondering what easing is it's how should the animation actually animate, should it speed up at first, should it speed up towards the end of the animation, should it slowdown, that sort of thing. I am going to choose ease. And then for the End Value I am going to type in 999 pixels. None of these boxes are going to be 999 pixels tall, what I'm doing is I am basically saying, hey, you're allowed to be that tall if you want to be. But what it's going to do is it will extend to its full height and then it will stop, it won't go past that and extend to 999 pixels, that just the upward ceiling, remember the property is maximum height.

All right, believe it of not, that is literally it, that's all we have to do. I am going to go ahead and create that transition and we are done. I am going to do a Save All, and I am going to preview this in my browser. When I scroll down and hover over one of these now, notice it animates down as I hover off of it, it animates back into place, and it's going to do that for each one of those where the condense class is applied. If that condense class isn't applied you don't get that functionality. So how cool is that, it's so super easy to do.

Now if you ever want to tinker around or modify with the transitions that you have, even if you have hand-coded those, you can do that quite easily. I am going to switch back into Dreamweaver really quickly. And you'll notice that within our CSS Transitions Panel we see this one being listed. So if you have to hand-coded that it would still pick it up in this panel and allow you to edit it visually, this is how cool this panel is. If I double-click hover, it's going to bring the same dialog box back up and now I could add more properties or I could change things, like I could make the Duration .75 seconds if I wanted to. You can save the transition, do a Save All again, and if I go back into my browser the animation is going to take just a little bit more time, I probably should have made it like 2 seconds so you could really see it, but you also take my word for it.

So the CSS Transitions themselves, if you want to see what these transitions look like you can see there is a section.condense and there are all the transitions. These are called vendor prefixes, and since CSS Transitions are so new, a lot of the browsers actually use vendor prefixes to support them until the syntax is standardized. So here we have our transitions. You will notice that it says max-height, there is the length of it, there is the easing that we are using, and there's the delay, in this case no seconds. Now the actual selector for hover, because we weren't really paying attention to it, it placed it at the very, very bottom of my code.

You can see for example, there is section.condense:hover, max-height: 999 pixels, and that is all there is to a transition. So you could certainly code this by hand if you wanted to or you could go over to CSS Styles Panel and code them as well. But having the convenience of the CSS Transitions Panel means that you can experiment with the settings and the rules are at much faster pace. And it ensures that if you're new to CSS that you're using the proper syntax. It doesn't mean that you won't run into problems, as I mentioned earlier if I had known about the browser support issues of height and transitions, I would have been pretty frustrated.

So be sure to take time to test any transitions that you create thoroughly in multiple browsers.

Show transcript

This video is part of

Image for Dreamweaver CS6 Essential Training
Dreamweaver CS6 Essential Training

90 video lessons · 52968 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 1m 4s
    1. What is Dreamweaver?
      1m 4s
  2. 5m 44s
    1. Welcome
      1m 4s
    2. Using the exercise files
      2m 17s
    3. Learning web design
      2m 23s
  3. 1h 0m
    1. Looking at the Welcome screen
      5m 9s
    2. Exploring Windows and Mac interface differences
      5m 6s
    3. Arranging panels
      8m 44s
    4. Managing workspaces
      10m 14s
    5. Exploring the Application toolbar
      6m 21s
    6. Exploring the Document toolbar
      8m 47s
    7. Working with the Property inspector
      9m 30s
    8. Using the Insert panel
      6m 30s
  4. 53m 3s
    1. Understanding basic site structure
      3m 46s
    2. Exploring file naming conventions
      2m 10s
    3. Defining a new site
      5m 23s
    4. Managing files and folders
      7m 57s
    5. Adding remote servers
      7m 4s
    6. Uploading files
      12m 46s
    7. Previewing in browsers
      9m 11s
    8. Managing multiple sites
      4m 46s
  5. 36m 41s
    1. Creating new documents
      6m 49s
    2. Setting up new document preferences
      5m 30s
    3. Setting accessibility preferences
      6m 49s
    4. Working with starter pages
      4m 32s
    5. Managing starter pages
      13m 1s
  6. 37m 23s
    1. Getting text into Dreamweaver
      8m 43s
    2. Importing Word documents
      4m 6s
    3. Adding structure to text
      7m 35s
    4. Creating lists
      4m 35s
    5. Creating definition lists
      4m 0s
    6. Using the Quick Tag Editor
      8m 24s
  7. 44m 41s
    1. Exploring the Code toolbar
      5m 41s
    2. Setting code preferences
      7m 19s
    3. Using code hints
      8m 8s
    4. Wrapping tags
      5m 7s
    5. Adding comments
      6m 29s
    6. Using snippets
      7m 32s
    7. Formatting source code
      4m 25s
  8. 1h 19m
    1. Setting CSS preferences
      9m 32s
    2. An overview of the CSS Styles panel
      9m 23s
    3. Creating a new CSS rule
      6m 42s
    4. Using the CSS Rule Definition dialog
      7m 25s
    5. Organizing styles
      7m 22s
    6. Modifying style properties
      6m 17s
    7. Controlling CSS through the Property inspector
      6m 37s
    8. Attaching external style sheets
      5m 54s
    9. Using CSS visual aids
      7m 3s
    10. Using CSS Inspect
      6m 48s
    11. Using the Code Navigator
      6m 39s
  9. 1h 11m
    1. Managing assets in Dreamweaver
      7m 30s
    2. Setting external image editing preferences
      4m 26s
    3. Placing images on the page
      10m 12s
    4. Exploring Photoshop integration
      7m 17s
    5. Modifying Smart Objects
      9m 42s
    6. Modifying image properties
      8m 4s
    7. Styling images with CSS
      6m 45s
    8. Using background graphics
      7m 28s
    9. Positioning background graphics
      10m 10s
  10. 36m 23s
    1. Link basics
      3m 17s
    2. Setting site linking preferences
      2m 19s
    3. Creating links in Dreamweaver
      9m 17s
    4. Using absolute links
      3m 43s
    5. Using named anchors
      6m 41s
    6. Creating an email link
      5m 25s
    7. Creating CSS-based rollovers
      5m 41s
  11. 44m 30s
    1. Reviewing table structure
      5m 20s
    2. Importing tabular data
      6m 46s
    3. Creating accessible tables
      6m 11s
    4. Exploring basic table styling
      9m 42s
    5. Styling alternate rows
      8m 57s
    6. Creating custom table borders
      7m 34s
  12. 59m 15s
    1. Understanding how forms work
      2m 45s
    2. Reviewing form design
      3m 44s
    3. Creating accessible forms
      5m 16s
    4. Setting form properties
      2m 39s
    5. Using the fieldset and legend tags
      2m 52s
    6. Inserting text fields
      6m 56s
    7. Inserting list menu items
      7m 54s
    8. Inserting checkboxes
      4m 14s
    9. Inserting radio button groups
      3m 52s
    10. Inserting submit buttons
      2m 25s
    11. Exploring basic form styling
      8m 2s
    12. Exploring form element styling
      8m 36s
  13. 33m 25s
    1. Adding CSS3 transitions
      8m 29s
    2. Spry overview
      2m 44s
    3. Using Spry widgets
      3m 57s
    4. Adding Spry effects
      8m 1s
    5. Using the Widget Browser
      7m 4s
    6. Extending Dreamweaver
      3m 10s
  14. 1m 2s
    1. Additional resources
      1m 2s

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

Are you sure you want to delete this note?

No

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.