Archive for the ‘CSS’ Category

Use CSS: Why using jQuery to add a hover class is just wrong.

Tuesday, January 19th, 2010

I don’t know a ton about CSS, but I recently found myself needing to add a hover class to a fairly complicated ajax driven application.  I fought for several hours trying to use the jQuery .addclass() method on mouseover to add a hover class I created.  While this worked great on existing elements those created via ajax took no effect.  After scrambling through the code and calling my method a dozen times I finally had something that vaguely worked.  And just when I was ready to move on I thought I would torture myself by adding the CSS ‘:hover’ class to my original hover class and see what happened.  It worked perfect.  Freakin perfect.

I was convinced that ‘:hover’ could only be applied to <a> tags.  I was wrong.  It seems that it works in Firefox, Safari, and at least the later versions of IE.  So let’s let CSS do what it does so well, which is style, and jQuery do what it does so well, which is things other than styling.

Skinning our Word Press Blog: a “Banana Cake Simplicity”

Sunday, November 1st, 2009

Part of our website “housekeeping”, or more like, the reason for it, was to update our site to be more web 2.0. This included setting up a blog and connecting it to our site. Matt very quickly found a way to bring the latest postings to our homepage (check the posting), however skinning the blog took us more time. But here it is!

The Before and After

The Before and After

(more…)

Creating a simple sliding navigation with jQuery

Friday, October 30th, 2009

As we know, jQuery not only makes things once considered impossible on the web possible, but makes those things pretty easy to do. I just built a sliding navigation for pukkared.com portfolio and thought I’d share here. Pulling this off requires both CSS and javascript knowledge. I’ll do my best to explain the CSS involved, but maybe Adri can follow up on this post with some more detail on why it works. I’ll also note that practically this navigation would be dynamically driven, but for the sake of simplicity I’m going to hard code the navigation. Maybe I’ll follow this up with a post on outputting your navigation from your database.

(more…)

Ever wonder how to make your CSS compatible with previous versions of IE 7.0?

Friday, October 23rd, 2009

So this is the thing. Our website (currently under “House Keeping”), besides having out-dated copy (that we worked on for the launch of the site and then forgot, sound familiar?) looks fine until you see it in versions of IE previous to 7.0.  And even when we want to believe that there are very few people with browsers this old, you go to a client meeting and there you have it, your precious site looks like crap!

So whenever we decided to “take it 2.0″ and add new features like a section to post recipes we cook (recipes?? cooking recipes?? Yes! Besides cooking a lot of design, html, css and cfm, that’s the one thing we do a lot of! So we decided our website to be the best place to share with family and friends).  We said: “Better clean our code and organize the house, before we go adding more rooms.”

Now, my contribution in this post is to share a snippet of code that is making my life very easy in the housekeeping we are doing. If you ever wonder how to make your CSS compatible with previous versions of IE 7.0 without having to modify your design, here’s how you can do it. (Unfortunately I found this snippet a while a go so I can’t credit whomever posted or came up with it, if you are that person let me know! :) )

Here it is:
<!– Will only be read by IE versions less then IE 7–>
<!–[if lt IE 7]&gt;–>

Place this snippet, below the link of your main style sheet(s).The browser will read those first, and if it is a version previous to IE 7.0 it will start reading your alternative style sheet “mystylesheet.css”. In this style sheet put those rules you want to modify for IE, like a rule that assigns a .PNG as a background for a div and then modify them accordingly.

Here is an example:

A style from your original CSS would look like this:
#div_body {
float: left;
width: 850px;
background-image: url(../images/bg_content_shadow.png);
background-repeat: repeat-y;
padding-right: 4px;
padding-left: 2px;
position: relative;
}

The same style is overwritten for I.E 6 and below like this:
#div_body {
background-image: none);

}