background preloader

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

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. 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. 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. $ npm install sprity -g

SpritePad - Create and edit css sprites SpriteMe CSS Tools: Reset CSS The goal of a reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on. The general reasoning behind this was discussed in a May 2007 post, if you're interested. Reset styles quite often appear in CSS frameworks, and the original "meyerweb reset" found its way into Blueprint, among others. The reset styles given here are intentionally very generic. There isn't any default color or background set for the body element, for example. I don't particularly recommend that you just use this in its unaltered state in your own projects. In other words, this is a starting point, not a self-contained black box of no-touchiness. If you want to use my reset styles, then feel free! Previous Versions v1.0 (200802) Acknowledgments Thanks to Paul Chaplin for the blockquote / q rules.

Useful Collection Of Free CSS Libraries & Resources Here we are presenting a very useful collection of some free CSS libraries and resources for your inspiration. Although there are many scripting and coding websites that can help you in developing your website but here we are presenting free and useful libraries and resources. In addition, there are some scripts also available that you can download and can use for your project. We hope that you will like this collection and find this collection useful for you as well. Print.css print.css is an open source print stylesheet for the environmentally-conscious web developer. CSS3 Click Chart Allows you to change how the browser calculates the width of an element, that is, whether or not to include padding, borders, and margins, in the width or height calculation. CSSDeck Collection of Awesome CSS and JS Creations to help out frontend developers and designers. CSS Navigation CSS Navigation Techniques (37 entries) Pondasee Pondasee is front-end starter kit to speed up front-end workflow. YUI Library

Offline.js – Handle your users losing their internet connection like a pro What is Offline.js? Offline.js is a library to automatically alert your users when they've lost internet connectivity, like Gmail. It captures AJAX requests which were made while the connection was down, and remakes them when it's back up, so your app reacts perfectly. It has a number of beautiful themes and requires no configuration. Install The easiest way to add Offline to your site is with Eager. Click Install to see a live preview of Offline on your website. Download Offline.js Pick a Theme Indicator Themes Submit a theme! Documentation HubSpot

CSS code structure for HTML 5: some useful guidelines In this post I want to illustrate some useful guidelines about how to implement a well organized CSS code structure in view of introduction of HTML 5 markup language. They are not general rules but simple suggestions you can follow in order to improve the readability, manageability, and general organization of CSS code. These suggestions are especially useful if you have to work on complex CSS files that otherwise can be difficult to manage. I prefer to separate CSS code in three distinct sections: a first section that contains general HTML tags; a second section that contains structure tags; a last section with custom classes. Section 1: General HTML tagsIn this section I divide the code in two subsections. Section 1: Subsection 1How you know, regarding CSS reset, this practice is used to reset default browser styles for HTML standard elements (body, h1, p, ul, li, ...). border:0;margin:0;padding:0;font-size:100%;... /* Subsection 2: Standard HTML tags redefinition */body, form, input {

CSS-Only Responsive Layout with Smooth Transitions A tutorial on how to create a 100% width and height smooth scrolling layout with CSS only. Using a radio button navigation and sibling combinators we will trigger transitions to the respective content panels, creating a "smooth scrolling" effect. View demo Download source In this tutorial we will create a responsive 100% width/height layout with some smooth page transitions. Please note: the result of this tutorial will only work as intended in browsers that support the respective CSS properties. Note that we will exclude vendor prefixes in this tutorial. The Markup The structure will be consist of a main container with the class st-container which will contain the radio buttons and link, and the wrapper with the class st-scroll for the panels. What we want to do is basically move the panel wrapper by changing it’s top value and bringing the respective panel into the viewport. OK, let’s style this thing! The CSS Let’s take a look at the main container’s style: And that’s all!

Bitcoin, Litecoin : montez votre propre mineur ! : Composants informatique Book - Scalable and Modular Architecture for CSS I have long lost count of how many web sites I’ve built. You would think after having built a few hundred of them I would have discovered the “one true way” of doing it. I don’t think there is one true way. What I have discovered are techniques that can keep CSS more organized and more structured, leading to code that is easier to build and easier to maintain. I have been analyzing my process (and the process of those around me) and figuring out how best to structure code for projects on a larger scale. SMACSS (pronounced “smacks”) is more style guide than rigid framework. Inspiration In trying to learn more about what does and doesn't work in maintaining larger projects, I looked at how others were trying to solve similar problems. What’s in here? My thoughts have been compartmentalized around a number of topics related to CSS architecture. Now get started and dive in!

How to make a carousel using only HTML and CSS (no JavaScript required!) Recently, I’ve been working on a site that uses a CMS that’s a bit limiting. I can add my own HTML and CSS to the site, but JavaScript is off-limits. The designs I’m working from included a carousel. This is the first item Idque Caesaris facere voluntate liceret: sese habere. This is the second item Vivamus sagittis lacus vel augue laoreet rutrum faucibus. And finally, the third Quis aute iure reprehenderit in voluptate velit esse. Let’s build one! The structure The structure of our carousel goes something like this: We have a main div.carousel-wrapper that gives our carousel its size. Each of our div.carousel-item elements have some content within them, and two links, a.arrow-prev and a.arrow-next, which we use to cycle between the carousel items. Because our individual carousel items will be position: absolute (so we can stack them on top of eachother), we have to set the div.carousel-wrapper’s height manually, and it makes sense to do this inline. <! That’s it for our HTML. The styles

Related: