free hit counters
If you are using Internet Explorer as your browser please be running at least IE 7 or above. This site does not support IE 6 or below. Go here for the latest free version including easy download and installation instructions If you want to make it real easy on yourself, download Firefox , the most popular browser in the world. It's free and simple. You'll be so glad you did.
Jan
20
2009

Add an image to your widget headline

If you look at my sidebar you’ll see that “Categories” and “Latest Tutorials” have a purple splash behind the headline. That is an image. I created it in photoshop. You can put whatever type of image you want, within reason, in your widget headline. The default line height for the widget headline is 1.385 em’s. Obviously if you want to put in an image that’s bigger than that then you’ll have to change that property.

In your custom.ss file add the following code. You can put it anywhere you want but I recommend putting it at the top. Remember, once you make the change, save it, and upload the new file to your server. Always describe what you’re doing by putting your descripton between the comment tags /*  */ at the beginning shown below in green. The comments aren’t shown on your rendered page and it just makes things easier for you to remember…

/*custom image in widget headline*/
.custom .sidebar h3 {
background: url(images/name of your file.jpg) no-repeat ;
line-height: 3.6em;
padding-left: 2em;
color: #000000;
}

The image can be a jpg, gif, or png

I changed the line height to accomodate my image size

The padding was to move “Customize Thesis” over a little bit

The color was to make the headline text darker

Leaving a comment with code in it...

If you would like to leave a comment and you have examples of code you want to show, you must "escape the code". This allows the entire code to show correctly by inserting certain variable around certain tags to make them show. If you don't "escape the code" your code will show up broken, mangled, and it won't be able to be seen correctly. "Escaping the code" is very simple...

  1. Copy your code you want to show
  2. Click here to go to the site to escape the code
  3. Follow the directions, it's so easy
  4. Once you have the escaped code copied, paste it in the comments area where you want
  5. Now you can enjoy life


Go ahead, leave a comment...

{ 2 comments… read them below or add one }

darcy@lwm3b April 27, 2009 at 4:17 pm

So that works if you want every h3 to have an identical image.

But what if you don’t? What if you wanted some red or blue or yellow instead of all purple fuzz in the background?

Or, in my case, if I actually wanted different images for each h3? It’s easy to do for the ones with unique h3 names like _categories or _archives. But when you create a text box they all have the id _text.

Then what?

Best hack I can tell is just to add an within the widget box itself. Which, works well enough, I suppose. :)

That’s what I’m trying to ask in the forums. Probably not clearly or well.
Here is my site: motherroad66.com

Thanks for trying to answer my question. ‘ppreciate it muchly.

-Darcy

Reply

Nasty April 27, 2009 at 5:31 pm

When you create a text box whatever you put in it, give it a unique class name. That way you can customize it in your custom.css.

Let’s say you have two text boxes. In one wrap everything in it with a <div class="unique name 1"></div>
In the other text box wrap everything in it with another <div class="unique name 2"></div>

Then in your custom.css your going to customize each text box like this…

.custom .unique name 1{ }
.custom .unique name 2 { }

Reply

Leave a Comment

Previous post: Add a border around your images in posts

Next post: Move the search bar