Code Explosion – Week 2

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.

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback

[…] your sweet tooth isn’t satisfied, check out some of my other Code Explosion posts: Week 1 and Week 2. Tags: code snippets, freelancer, HTML5, jQuery, tweets, […]

John Hartley is a Director of Product Engineering at Beam Dental in Columbus, OH. With 5+ years of leadership experience he has worked in startups, agencies, and began his career as a freelance Front End Developer. Always looking to iterate, this blog is a place for him to share his knowledge as well as hone his craft, challenge assumptions, and build a strong base of leadership and management knowledge. Connect with him on LinkedIn

1
0
Would love your thoughts, please comment.x
()
x