CodeinWP CodeinWP

Quick Tip: Use HTML Comments to Indicate Pseudo-elements

Use HTML Comments to Indicate Pseudo-ElementsAt the recent W3Conf Nicolas Gallagher explained that although pseudo-elements have helped us add decorative content to our pages while keeping our HTML clean, this has led to some maintainability issues.

Developer tools can help to some degree, but oftentimes dynamically added content like pseudo-elements or extra elements added via JavaScript are initially harder to track down.

As Nicolas pointed out, the far-future improvement in this area is the Web Components spec, but I think this is something we can improve on right now.

Read Article

thatsNotYoChild.js — Fixing Parent-Child Opacity

Parent/Child signOne of the posts on this website that consistently gets a significant amount of traffic (5000+ page views this month alone) is a ridiculous article I wrote that discusses how to make a child element not inherit the opacity setting of its parent.

As we all know, opacity property can be annoying in this area.

Basically, if a parent element has an opacity value set at, say, 0.5, all of its children will inherit that opacity setting, and there’s no way to reverse that opacity on the child elements.

Read Article

My Talk and Slides from jQueryTO

jQueryTOOn March 2nd and 3rd, I attended and had the privilege of speaking at jQueryTO, Canada’s first ever jQuery conference. It was a really cool experience, and was especially cool because I finally got to meet in person certain developers that I’ve respected from afar for some time, including Darcy Clarke (who organized it), Paul Irish, Addy Osmani, Alex Sexton, and Adam J. Sontag.

If you’ve been reading this blog for awhile now, then you know that I have little, if any, business speaking at a JavaScript conference. So I tried to keep things fairly simple for myself and proposed a talk where I could focus largely on CSS.

Read Article

Modular CSS with Media Queries and Sass

Modular blocksMost developers nowadays are recognizing that if you’re developing large applications that have different views and states, it is best to take a modular or object-oriented approach to your CSS development.

When you throw media queries into the mix, however, the you can lose some of the benefits of modularity — code that’s easy to read, update, and maintain.

Let’s look at different ways we can write our media queries, starting with what might be the most common approach — especially with those not yet using a preprocessor.

Read Article

JavaScript ‘this’ in Different Contexts

JavaScript thisJavaScript has a reserved keyword called this that references something different depending on where you are in a JavaScript program.

In this post I’m going to summarize, by example, some different contexts and discuss what “this” would represent in each case. Note that all of these examples assume you’re developing client-side JavaScript in a browser.

Read Article

Browsing Twitter Favorites From Talented Developers

Browsing Twitter Favorites From Talented DevelopersIf you’re like me, then you probably find that your “home” Twitter stream (that is, the tweets of people you follow) is okay, but often contains a lot of noise and not-so-useful info.

What if you were able to see only the tweets that respected web professionals found to be exceptional? Well, you can do that quite easily by viewing a user’s Twitter favorites.

Read Article

I Can’t Create

I honestly can’t stand the thought of creating a new design from scratch. It’s bad enough that I’m not a formally educated designer (last I checked, buying design books on Amazon does not constitute a formal design education), but on top of that, I just don’t have the ability to innovate. Almost everything I’ve created […]

Read Article

My Current JavaScript Design Pattern

My Current JavaScript Design PatternWith every major JavaScript project, I’ve tried something new, improving on what I’ve written before. Currently, whenever I build something from scratch, I use a variation of what Addy Osmani and others commonly refer to as the module pattern.

Here is my version below, which assumes jQuery, and then I’ll provide some explanation of what’s going on here and how I use it:

Read Article