Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,900 courses, including more Web and personalized recommendations.Start Your Free Trial Now
- View Offline
- Exploring HTML5 templates in Dreamweaver
- Understanding document flow
- Using floats properly
- Resetting CSS styles
- Creating a 1-, 2-, or 3-column layout
- Deciding on a fixed width versus variable width design
- Coding layouts for HTML5 and CSS 3
- Incorporating floated elements
- Applying the faux column technique
- Using Spry widgets
- Using Multiscreen Preview
- Modifying desktop layout for tablets
- Developing smart phone layouts
Skill Level Intermediate
When I first heard the term accordion panels I thought, what, they play music? Sadly, my fantasy did not come true. Instead accordion panels are a wonderful addition to the designer's layout palette that can hold a great deal of content in a concentrated space. Let me show you one example of highly stylized accordion panels. That's on this page here in the Our Services area. If you click on any of the titles each of the panels fly up with a little animation and expose the content.
When you hover over labels they change its background color and it becomes bold. These particular accordion panels are based on Adobe's Spry framework and in this video I'll show you how I styled them to fit perfectly in my site as an example of how you can integrate accordion panels into yours. So let me close out this index.htm and show you this index.htm and if you scroll down a bit you'll notice that there are no accordion panels yet installed. We're going to do that right away. So if you place your cursor right after Our Services and then select h2 we're going to move the cursor right after the h2.
Just press the Right Arrow key once so that you'll be still within the content div, but after the accordion panels. To verify this you can open up Split view if you want and there you can see that's where the cursor is right after the h2 statement. Let's go ahead go back to Design view and open up the Insert panel. We want to go to the Layout category and scroll down a little bit until you see Spry Accordion.
Click that once and this will insert the default arrangement for the spry accordion which sets up two accordion panels. I'm going to open up the Properties panel for a little bit. Scroll down here so we can still see our accordion panel. Now whenever the Spry Accordion tab is selected up here the bright Blue one that you see, the Property Inspector will show all the properties available to you for the Accordion panel. Now one of the things we can do is add additional panels, and if you'll recall I had a good number of them available in the completed example 06 and all.
So let's go ahead and hit the plus button a number of times. So there is Label 3, 4, 5, and 6. In this example I'm not going to change any of the labels or bring in any content we're just going to concentrate right on the styling. Now I'm going to Save the page and watch what happens. Dreamweaver will bring up a dialog box to let you know that it has some dependent files that it needs to bring into the site and it's going to bring them in and put them in the site root in a folder called SpryAssets.
So I'll click OK and I'm going to open up the Files panel a little bit just to show it to you. Now let me close the CSS Style to give us some more room and there you can see in the root of my folder is the SpryAssets folder and within that is SpryAccordion.css and SpryAccordion.js.
Let's prepare for the next couple of steps by opening up the CSS Styles panel completely. Now depending on the level of customization that you have to do to adapt your spry widgets to your site you can either go in and make modifications to the SpryAccordion.css page that we see here and that's listed in the CSS Styles panel in the All mode, or you can create your own spry CSS file. When there are a lot of changes to be made I like to pick the secondary route, because it allows me to keep my styles completely separate if I want to use the default setup in another location on the site.
So to do that what I'm going to do is go into SpryAccordion.css choose Command+A on the Mac, or Ctrl+A on the PC in order to select everything and then copy it with a Command+C or Ctrl+C. And now I'm going to create a new CSS file by going to File>New and choose Blank Page and the Page Type this time will be CSS and I'll just click Create.
And once that opens up I'll go ahead and use Command+V to paste in everything that I copied and let's Save this as a new CSS file and this time I'm going to keep it in the Chapter 4>04_04 folder. There is a styles folder there and I'm going to call it mySpryAcc for accordion. Save that.
Now the next step is to go to the source code for our page and we'll link in our newly created files. So if you go down to the bottom of the CSS Styles panel the first button that you see there in the group on the right is Attach Style Sheet. It looks like a couple of pieces of chain for linking. Then once the Attach External Style Sheet dialog box opens click Browse and you want to navigate to the Chapter 4>04_04 folder find the styles folder and then select mySpryAcc.css.
Perfect! So I'm going to go ahead and save this configuration and now let's go back out to Design view and start making some changes. So we can bring in the default accordion panel into something that works well with this site. In All we're going to change eight out of the nine rules that are available to us in the Spry Accordion panel. I'll show you exactly what changes to make in the next movie.