Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In the video about introducing CSS, we peeked at the style sheets that make up a typical Drupal theme, and you saw how mind-bogglingly complicated they can be. The biggest problem is in determining which styles affect a given element on your page; even with developer tools like Firebug, it ain't easy. The Theme Builder in Drupal Gardens goes a long way to making CSS more accessible, including the ability to select individual styles; but it's still a little tricky. This video leads you around some of the traps.
First of course, we go up to Appearance to bring up the Theme Builder. Just as a reminder, this little tab up here shows that we are working with the exp_cal_02 theme. That's one of the themes we created earlier. I am going to save it as a different name once again, as a good sort of way to make sure that we can roll back if anything goes wrong; ex_cal_03 and save it. I will also publish that theme so we can keep track of it as we go.
In the Theme Builder, CSS is mostly affected through the Styles tab. As we go around the page and click on things, we see this message here, "You are styling," and then it describes what it is: "All links in all list items in the navigation region." This is actually an English language translation of what the CSS actually is. Over here, you can turn it on so you see the real CSS. So I'll switch it from off to on, and watch what happens with this, "You are styling" message.
See, it was all links in all list areas in the navigation region. If we turn it off again, you can see. I'm going to keep it on the CSS Styling, so that we can start to learn CSS as we go. By the way, this is a great way to learn and understand CSS. It's a good way to even test yourself. You can point at something and say, okay, with the CSS off, it's all links in all list items. Okay, if I would have put that in CSS, it's going to be something like #preheader-second li a, and then if I turn it off, that's exactly what it is. Very good.
The other switch here is this Power theming switch. Watch what happens with this You are styling area as I turn it on. There are two changes. First of all, there's a hierarchy indicator. It shows exactly what is being styled, even if there aren't any styles that are affecting it from that thing. For example, the bit up here which is what we're styling: We know that it's a link. We know it's in list. It's also part of this ul container, which is again in a block. This is a block up here. It's part of the body, which is the entire page, and so on.
The other thing that's different when you turn on the Power theming is these little pop-down menu show up. Let's do that next to the a here. We can now select to change the theme, not only for the link as it shows right now, but what happens when you hover over it or when it's already been visited. These are those pseudo-classes I mentioned in that earlier video about introducing CSS. There is something that you will notice as you point at elements on the screen; they will often have these little arrows which will be either above, below, or to the two sides.
As you hover over them, it tells you exactly what it is you're going to go to by clicking on that arrow. In this case, it says, Select the parent element. Let's click it and see what happens. See, it went from li to ul. If we were to click it again, it then goes to the larger area of header. Similarly, we have these siblings to the right and sometimes to the left. These words--parent, sibling, and child-- are somewhat complicated, but they're all related to the way that web pages are structured, and that's according to something called the Document Object model, or DOM.
Two lynda.com courses that explain it well are "XML Essential Training" and "Real-World XML." If you search the lynda.com site for XML of course, you may find others. I would like to go back and start selecting individual elements here, like let's click this Mission element here. Now as you go down here, you can actually turn on or turn off other styling selectors, like ul or navigation. Let's say that we want to do the entire navigation bar instead of just this navigation region, and we want it to be everything inside it, not just these links.
Well, we could turn those off by clicking like that. As we do that, you see that the selector, this little blue line around it, expands to show exactly what's being styled. Or if we were to say that we want all link items by clicking the a here and turning off navigation, you see that it actually selects every link on the page, no matter how it's styled. Even though this one looks different from this one, they're both styled with the a. So you can see that the Theme Builder really helps you understand CSS more than pretty much anything I have seen.
Now while you're doing this and you start styling things, try not to get too discouraged. CSS selection was one of the hardest things for me, personally, to understand when I first started using Drupal Gardens. Even after playing with it for a while, I still get stumped from time to time, particularly because some styles are located on top of each other so you can't easily click the one that's on the bottom. One good example of that is these links up here. In the menu you have the text, but then you also have the boundary box that contains the text, and it goes on like that.
It can be kind of confusing. Once when this happened to me, I got a lot of great help from the Drupal Gardens staff by posting a question in their community forum. You can learn how to do that in the video about getting help. One reason they were able to help me is that all of their themes are standardized, including the CSS style names. That also means when you learn how to style one Drupal Gardens theme, you are actually learning how to style all of them.
Get unlimited access to all courses for just $25/month.Become a member
58 Video lessons · 66050 Viewers
61 Video lessons · 96653 Viewers
56 Video lessons · 110364 Viewers
82 Video lessons · 105130 Viewers
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.