Start learning with our library of video tutorials taught by experts. Get started

Joomla! 1.5: Styling with CSS

Styling a search box


From:

Joomla! 1.5: Styling with CSS

with Jen Kramer

Video: Styling a search box

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.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
Joomla! 1.5: Styling with CSS
2h 29m Intermediate Jan 09, 2009

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.

Topics include:
  • Using the Firefox Web Developer toolbar
  • Styling Joomla! modules
  • Styling a multi-page article
  • Creating horizontal and vertical menus
  • Incorporating images in menus
  • Styling banner ads
Subjects:
Developer Web CMS Web Development
Software:
Joomla!
Author:
Jen Kramer

Styling a search box

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.


Expand all | Collapse all
Please wait...
Q: I’m having trouble understanding the role of the Start Level/End Level function in developing a menu, as described in the  “Styling Menus Vertically” video.  What is the key to understanding this function?
A: The Start Level and End Level are the way a menu is segmented, to show all or part of that menu.

By default, the Start Level and End Level are set to 0. This means that the entire menu will show.

If you would like to have just the top level navigation show (perhaps for a top menu bar), but none of the secondary, tertiary, or deeper navigation, set Start Level to 0 and End Level to 1.

If you would like to have just the secondary navigation show (i.e. you're in the "about" portion of the site and you'd like to have the about secondary navigation show on the left side of the page), set the Start Level to 1 and the End Level to 2. If you'd like to show all of the navigation (secondary, tertiary, and any deeper navigation), set the Start Level to 1 and the End Level to 0 (i.e. infinite).

The only tricky part about setting the Start and End Levels is that zero means different things in different locations.

For the Start Level, zero means the very beginning of the navigation. Engineers start counting with zero, while we are normally taught to start counting with 1, so this may be the cause of some confusion.  This means that 1 actually corresponds to the second level, 2 to the third level, and so forth.

For the End Level, zero indicates "infinity", or however far out the navigation goes.
Share a link to this course
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.
Upgrade now


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.

Upgrade now

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 Joomla! 1.5: Styling with CSS.

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 preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



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.

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