Seasonal Savings: 20% off selected memberships for a limited time. Give now

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

Styling Sliding Panels content

From: Dreamweaver CS3 Projects: Creating Custom Spry Widgets

Video: Styling Sliding Panels content

Currently the Sliding Panels are being styled by a combination of existing styles and the external Spry asset CSS. In this movie we'll add some local styling to make sure our panel groups look the way they're supposed to. Although we'll use embedded styles for the purpose of this exercise, you might want to externalize these styles in your own projects so you can reproduce the widget styling faithfully throughout your site. So I've got the details_start HTML file opened up and I found that in the Chapter 8 directory. So go to Chapter 8, if you're following along with me in the exercise files and open up details_start.

Styling Sliding Panels content

Currently the Sliding Panels are being styled by a combination of existing styles and the external Spry asset CSS. In this movie we'll add some local styling to make sure our panel groups look the way they're supposed to. Although we'll use embedded styles for the purpose of this exercise, you might want to externalize these styles in your own projects so you can reproduce the widget styling faithfully throughout your site. So I've got the details_start HTML file opened up and I found that in the Chapter 8 directory. So go to Chapter 8, if you're following along with me in the exercise files and open up details_start.

Now I'm just going to switch over to Code View, and I'll go ahead and hide my panels so again I get a little bit more space for my code. And I can see that I already have some embedded styles. I have of a section of thumbnail formatting. And I have a section of parent container formatting and that is the DIV tag that surrounds our Sliding Panels but doesn't really have anything to do with their functionality. So I'm going to start here. Now what I'm going to do- I'll scroll down a little bit further here- is I'll create a new line, right there on line 24, and I'll add another comment to give myself another section here and I'll like sort of spacing them out with some dashes so that they spread the whole length of the page.

I'm going to type in 'formatting for panel content' and then add a few more dashes here for my section. We're going hand code all of this. We're going to use some very specific selectors here because part of the problem with our current panels is that overall document styling is overriding a lot of what I want to happen. And so if we want our styling to work, I can't just use the class names inside the panel groups. I have to expand that and use some of the selector names that already exist within our file. So that's one of the reasons we're having to write more custom styling here.

So our first selector will be #mainContent, space, .Sliding, capital S, Panels, capital P, Content, capital C, Group, capital G. So be really careful. That's got to be spelled correctly and all the capitalization has to be correct. So capital S, P, C and G. SlidingPanelsContentGroup and it's a class style, class selector. And I hit space and then we're going to do h2. So what we're doing is targeting any header, heading two, inside of our SlidingPanelsContentGroup, which is inside of mainContents. So again a very specific rule that will help us overwrite any of the H2 selectors that exist elsewhere in our site.

So here we're going to do a margin and we'll do margin of 10 pixels for the top, zero for right, zero for bottom and then 220 pixels to the left. Now that may seem kind of weird to you guys, but what we're going to do is use some background graphics for each of those Sliding Panels and this'll push us all the way over to the right so the background graphic can display without the header displaying on top of it. Now I'm just going to keep these all on a single-line. If you prefer to break them down individually, you can. So I'll hit margin and then do another space. Here we're going to do a little bit of padding so I'll choose padding and we're just going to do zero padding all around and then I'll do background of none and that'll take off any default backgrounds that other headers might have. And then finally we're going to do a text align to the left.

Again, that's going to take away the default and so we're done with our heading two and we'll go ahead and close out our curly brace there. So here we've applied some custom margins to it. We've stripped out any padding that other heading two styles might be adding to this. We stripped at any backgrounds that might be existing in prior H2 tags and then we've reset the text alignment to the left. Alright. Let's go down to our next line. And here we're going to do a very similar selector, #mainContent, space, .SlidingPanelsContentGroup, and once you type that, if you really felt like copying and pasting it, you certainly could. And then do the p tag and let's open that up.

So this is going to target our paragraphs that are in our Sliding Panels and again we're using a descendent selector that invokes both the parent SlidingPanelsContentGroup panel and the mainContent DIV tag. So inside that we're going to do a margin and our margin is going to be 1em for the top margin. We're going to do is zero for the right. We're going to do a 1em bottom margin. So that's going to give us our vertical spacing in our paragraphs. And then we're going to do a left margin of 220 pixels. Notice that that is exactly the same as the heading two, so again we're giving enough space for those background graphics to show up.

We're then going to go ahead and give it a padding of zero and then a background of none, so very similar to what we've done prior to this. Then we're going to do a text-align of left, to go and reset that based on what any other selector is doing with our paragraphs. Again, don't forget your curly brace and now we've styled the heading two and the paragraph inside those content regions. The next thing we need to do is go ahead and handle the price. If you remember, we surrounded the price with a span tag so let's go ahead and style that. So we're going to do #mainContent, space, .SlidingPanelContentsGroup, once again remember the capitalization and spelling.

Then do a space, span.price. So we're going to do an element-specific class selector inside the descendent selector. Go ahead and open that up and type in 'display' and set display to block and then a semicolon. And then after that we're going to do font-weight. So we're going to do font-weight. We're going to style that as bold. Another semi-colon. Font-size is going to be 1.4 em's. Text-align is going to be right and finally the margins to the right of 10 pixels, and that'll hold off the edge of our Sliding Panels content.

So we styled the heading two. That's going to be in our panels. We've styled the paragraph and we've styled the span that surrounds the price. So I'm going to save that, flip back over to Design View and if I scroll down, I can see that we've got a lot nicer styling in here. There is our headline, there's a paragraph underneath it. And there's the price element. OK, let's go ahead and the preview that in our browser. And indeed, as we mouse through this, the only thing missing currently is our images. So we're going to have to style some background graphics in just a moment.

You might wonder, "Well, why didn't you just put in an image and then float the text around the image?" Spry widgets are not without their faults and one of the things I've noticed about these animated Spry widgets is that if you have floated elements inside of them, as they animate, the floats tend to become unresolved and then as the animations finish, the floats resolve themselves again. That can cause some flickering on faster animations and on slower animations they cause the text look really different until the animation is finished. So we're avoiding that by going ahead and applying a margin to the heading and the paragraph and then in our next exercise we'll create a background graphic for the image itself.

Our Spry widget is almost finished. The last thing we have to do stylistically is to create a couple selectors to apply background graphics for each of the elements and that's what we'll tackle in our next movie.

Show transcript

This video is part of

Image for Dreamweaver CS3 Projects: Creating Custom Spry Widgets
 

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
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Dreamweaver CS3 Projects: Creating Custom Spry Widgets.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

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.