Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Joomla! 1.5: Styling with CSS shows how those familiar with Joomla! and with hand-coded HTML and CSS can take the next step in creating a dynamic website with a unique look and feel. Jen Kramer McKibben goes deep into the functionality of this open-source content management system, exploring topics like putting more style into modules, editing CSS on the fly using the Firefox Web Developer toolbar, creating horizontal and vertical menu layouts, and including images in those menus. Exercise files accompany the course.
One of the great features that Joomla! comes with is a built-in search function. I am going to show you how you can get this in to your website and some of the options that you have for the search bar. Then I am going to show you how to make it a little bit prettier. It definitely looks functional right now but I think, we can liven it up a little bit to better blend in to the look and feel of this website. So I am going to start by going to the back end of my website and I am going to go Extensions > Module Manager, under Search in the Module Manager, if you click on that, we will be editing the search module. Like all modules on the left hand side of the page, you can set things like the title, whether or not you want that title to show, whether it's turned on and the position on the page you want it to appear, as well as which pages you would like it to appear on.
On the right hand side of the page, there is a number of great features that really lend themselves well to styling. First of all, you can change the Width of the box, the actual search box itself. By default, this is set to 20 pixels but you can change it to whatever you like. The Text box is what appears in the search text box. If it's left blank, it loads what's called the search box string from your language file. In this case, flipping back to the front on to the website, that's search... If we want something else, we can say find it here, for example. If we apply that and flip back to the front end of the website, you will see the text in the box has changed.
The Search button is that button to the right hand side. Because I have that button turned on and the Position set to Right for that search button, you don't have to have it, but I would recommend it because I think, many users feel lost, when there is no button on their search box. You can also set your Search Button to be an image, simply by setting the Search button option to Yes and then follow the directions very carefully in the balloon. The image must be named, search Button. That's lowercase search, capital b, searchButton.gif and it has to be located inside of the images/m_imagesdirectory.
So once again, this is a case of Joomla! being very particular about what it wants for things to work correctly. If you are going to include a Search Button, you can change the button text as well. Once again, by default it's loading the word, search, but I am going to change my Button Text to Go and I am going to take out this text that I put in here a little earlier and say Apply. I don't like it to say search... and then have the search button itself say search as well. I think, it's a little redundant. So now it says, search...
and then Go. Once you click in the box, that text will go away. Under the Advanced Parameters, there is some caching options that you probably will never need to change, but they are there, in case you do. Note also that there is this module Module Class Suffix as we have seen on other modules. So if you need some way of differentiating the search module from other modules in a similar area, the Module Class Suffix may be helpful to do that. Let's save our changes and now we can worry about styling our search box. I am going to refresh my page and now I am going to view the HTML. I am going to take a look at the top of the page for this line here, where we have a div with an id of search and inside of this div, there is two things, one is the tag line, this, enter a new dimension of good taste and that's followed by a div with a class of moduletable, which is the actual search functionality itself.
There is a form, another div with a class of search, and then the search input box itself and then the search button, which has a class of button. We will want that later because I am going to try to style that button a little bit differently than that gray looking button that we have now. Now that we know what the HTML looks like, let's write some CSS. Under CSS > Edit CSS, under default.css, let's find the search piece, which is here under the #headcontainer and their elements. There is a div here for search with its styling. So the first thing I am going to add is a div.moduletable because I would like to add some padding. Our search is smashed right into the very edge of the webpage. What it's like is for the edge of the button to align up with the e in taste. So we will put in some padding and we may need to adjust it, once we have modified our button, a little bit. 7 pixels on the top, 15 pixels on the right. Now I am going to work on that button here.
So inside of the div.moduletable, we are going to work with an input with a class of button. That will help differentiate it from the input that drives the search box. First of all I would like the color of the text to be white. I want the background to be that pink color. Although that border really detracts from the button, so let's get rid of that. I think, I would like to make the word, Go, uppercase and I would like it just a little bit smaller too. When you change the font size of the button, you may have noticed that the button itself shrink in size. That's a common occurrence with these buttons.
The next thing that we are going to do is change that search box to have a matching font size, so that the height of the search box and the height of the button are the same. Now let's add a little bit of breathing room between the button and the search box by putting in a margin on the left. Now let's concentrate on that search box. So once again, div.moduletable input and that search box is assigned an id of #mod_ search_searchword. Let's turn the border off and we need to reduce the font size, so that matches the size of the button. Once again, I am going to give it a little bit of margin as well.
So our search box has shaped up very nicely. Now I am going to copy and paste all of the CSS changes into my Joomla! template. So once again, Ctrl or Command+A, Ctrl or Command+C to select all of the text and copy, back to the back end of the website, under Extensions > Template Manager, under inside, Edit, under Edit CSS, default, Edit, Ctrl or Command+A to highlight everything, Ctrl or Command+V to paste, and save.
Now when I refresh my webpage, I have a great looking search box and that really enhances the look of the website. Once again, the search box is an extremely handy addition to any Joomla! website, particularly those of a larger size. Search boxes are becoming common on lots of websites and they are in demand with a lot of clients. It's so easy to add a search box to your Joomla! website. So you may consider adding one as well.
Find answers to the most frequently asked questions about Joomla! 1.5: Styling with CSS.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
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.