CSS Tip: Save different states of the same icon in the same file

Pro tip: when using CSS to change the state of an icon, whether a hover state or a disabled state, make sure to put all different states of the icon in the same file, then use CSS to determine what position of the file to use to display the background of the icon.

jQuery UI icons

The above doesn’t really cover what I mean, but it proves my point. The benefit of loading icons from the same file: no hiccup for when icons are loaded for different states of the icons.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s