background preloader

Howto

Facebook Twitter

Tips

Content. Databases. CSS Sprites: What They Are, Why They’re Cool, and How To Use Them. By Chris Coyier On This article has been revised and re-written several times since its very first publication in 2007, to keep the information current.

CSS Sprites: What They Are, Why They’re Cool, and How To Use Them

The most recent revision was done by Flip Stewart in January 2015. #What are CSS Sprites? Spoiler alert: they aren't fairies that write your stylesheets for you. I wish. To summarize: the term "sprites" comes from a technique in computer graphics, most often used in video games. CSS Sprites is pretty much the exact same theory: get the image once, and shift it around and only display parts of it. #Why use CSS Sprites? It may seem counterintuitive to cram smaller images into a larger image. Let's look at some numbers on an actual example: That adds up to a total of 14.38KB to load the three images. While the total image size (sometimes) goes up with sprites, several images are loaded with a single HTTP request. Thus, sprites are important for the same reasons that minifying and concatinating CSS and JavaScript are important. $ sprity .

#SVGs. The-z-index-css-property-a-comprehensive-look. Most CSS properties are quite simple to deal with.

the-z-index-css-property-a-comprehensive-look

Often, applying a CSS property to an element in your markup will have instant results — as soon as you refresh the page, the value set for the property takes effect, and you see the result immediately. Other CSS properties, however, are a little more complex and will only work under a given set of circumstances. The z-index property belongs to the latter group. z-index has undoubtedly caused as much confusion and frustration as any other CSS property.

Ironically, however, when z-index is fully understood, it is a very easy property to use, and offers an effective method for overcoming many layout challenges. In this article, we’ll explain exactly what z-index is, how it has been misunderstood, and we’ll discuss some practical uses for it. What is it? The z-index property determines the stack level of an HTML element. 3-dimensional representation of the Z axis: The Natural Stacking Order Link Why Does it Cause Confusion? Syntax Link. The Myth of DPI. The size of an image in a website layout is important.

The Myth of DPI

From proper alignment to getting just the right amount of white space, sizing photos and graphics properly beforehand is essential to creating a balanced look. Images on the web are measured in pixels. Yet many people go through the trouble of setting their images to 72 dots per inch (DPI). The process of sizing images for the web is often misunderstood. The misconception about resolution in digital images bound for the web is that they must meet a certain number of dots per inch. In print, pixels per inch and dots per inch impact the size of an image on a page. When someone converts an image to 72 DPI, they’re adding an extra step with no benefit. When someone asks you for a web image that’s, say, two inches wide, they’re estimating how it would appear on their own monitor.

Pixel Size Depends on Context A pixel (which is short for “picture element”) is the smallest unit of measure on a grid displaying a digital image. An Experiment.