Code Explosion – Week 2

Posted on: October 14th, 2011

Welcome to Week 2 of the Weekly Code Roundup. Check out some of the good snippets and tips below.

CSS selectors

One of the best snippets I found this week was:

a[href^="http"] {  
   /* selects all a href elements that begin with http */
   background: #FFF;  
   padding-left: 10px;  
} 

Source: Net Tuts

I haven’t actually found a use for this yet, but the possibilities have definitely expanded with this snippet. Be sure to check out the Net Tuts article for some more great CSS selectors.

Responsiveness

This week’s responsive snippet comes from Chris Coyier.

To get smooth image scaling in IE, be sure to add this snippet to your CSS:

img { 
   -ms-interpolation-mode: bicubic; 
}

One of the greatest things I learned while reading ‘Responsive Web Design‘ by Ethan Marcotte was about mathematics. Remember that calculus class you took? Well you won’t need integrals or derivatives, but you will need to know some division skills to create the greatest fluid design ever.

It mainly starts with your design. You take the main width and everything then becomes a fraction of the main width. For an example of what I’m talking about, take a look at Ethan Marcotte’s CSS.

Look for any width that is a percentage. Most will have a comment next to it like this /* 800px / 960px */.

More on this topic in a later post.

Question of the Week

The great dash underscore debate, which do you prefer? When naming classes and identifiers, do you use ‘-‘ or ‘_’? Respond below.

Check out last week’s Weekly Code Roundup and my first post on WordPress Responsiveness.

To start your weekend, enjoy this Team Fortress 2 IRL video from Corridor Digital.

Tags: , , , , ,

previous post: Code Explosion – Week 1 next post: Why The Library Rocks