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

Long Shadow Buttons with CSS3 and Sass - Creative Punch Alongside flat design, long shadow design is definitely still rising in popularity. It is used in many ways but still looks best for icons! In this article I will show you how you can easily make long shadow buttons with CSS3 box-shadow by using Sass. We’ll also look at some best practices to make our code more reusable, where to get the right color values for all the popular brands and using icon fonts. So let’s dig into the code for our long shadow buttons! Using icon fonts and preparing our HTML We’ll be using both Zocial and Font Awesome. So let’s import the fonts for our long shadow icons in our Sass CSS. Note: I use the SCSS syntax which is the preferred syntax since Sass 3. Now, let’s add the corresponding HTML. Styling the buttons Now, as you can see aside from the icon classes, I also added the classes twitter, facebook, stumbleupon and google-plus, as well as the class social-icon. The plan here is to make our CSS as reusable as possible. So let’s style those classes! That’s it!

SpriteMe CSS Drop Down Menu Big Collection | Flash, Design, Vector, Photoshop, Adobe Tutorials | GraphicMania.net I have collected another collection of CSS drop down menus to add to your library. This collection consists of amazing wonderful CSS drop-down menus themese with different styles. This collection is another part of the CSS library in addition to free CSS layouts and templates , amazing CSS buttons tutorials and free CSS navigation menus This drop down menu uses more ‘colored’ classes to apply a background image to each category with the css property background. Compatible with IE7, Firefox, Safari, Opera. Compatible with IE6, using the .htc file .httc as explained in the tutorial (included in the zip file – not applied to the above example). Chrome Menu is a CSS and JavaScript hybrid drop down menu. * Ability to easily “left”, “center”, or “right” align the menu items easily, just by modifying the CSS property “text-align”. * Optional “swipe down” transitional effect for revealing the drop down menus. * Support for multiple Chrome menus on the same page. 2- Easily deployable. Features

Things To Avoid When Writing CSS Things To Avoid When Writing CSS Disclaimer: You may disagree with some of the things I’ve written in the ensuing article. That is okay. Multiple files A lot of web development seems to be about splitting things up into manageable chunks or “components”. This doesn’t work so well for CSS. CSS is an ordered, exception based language and there is no easy way for a file listing (which is typically organised alphabetically) to represent it coherently. - buttons.css - reset.css So you have two choices: You can either live in denial, grumbling that “specificity shouldn’t be part of CSS” as you try to force a square peg into a round hole, or you can work in one, well-commented file that clearly represents the arc of your inheritance-harnessing cascade. Summary: You shouldn’t organise CSS by splitting it into separate files any more than you should organise a pane of glass by dropping it on a concrete floor. Nesting (with Sass) I’m ambivalent about Sass. Nesting, though? Fucking. Pixel units What?

CSS Sprites Revisited Css Globe | Web Standards Magazine Quick Tip: The Simplest Way To Center Elements Vertically And Horizontally Danny Markov Flexbox is a relatively new addition to the CSS world and we keep finding more and more excellent applications for it. We can even solve the age-old problem with centering an element both vertically and horizontally with CSS. It is easier than you can imagine – it is only three lines of code, doesn’t require you to specify the size of the centered element and is responsive-friendly! This technique works in all modern browsers – IE10+, Chrome, Firefox and Safari (with the -webkit- prefix). See the full compatibility table here. <div class="container"><! Run The HTML The idea, of course, revolves around flexbox. You can place this container div anywhere you want. The CSS As we said earlier, we will be using only three lines of code. Every flex container has two axis for positioning elements. Now all that we need to do is center both axis. Conclusion There are lots of other techniques for centering content with CSS, but flexbox makes this a whole lot simpler and more elegant.

8 CSS preprocessors to speed up development time Less CSS Less is probably the most well known CSS preprocessor. It allow a simplified syntax and the use of variables. Less CSS is for the Ruby programming language, however it looks like Aaron Russel created an extension for creating cached stylesheets your PHP projects can use. Get it: Sass On their website, Sass claims to make CSS fun again. Get it: Turbine If like me, you’re a PHP Lover, here is a css preprocessor made for your favorite language. Get it: Switch CSS Switch is a full featured, production ready CSS preprocessor. Get it: CSS Cacheer CSS Cacheer is a very cool preprocessor which allows developers to create plugins. Get it: CSS Preprocessor Another interesting preprocessor, written in PHP 5. Get it: DtCSS speeds up CSS coding by extending the features to CSS.

Web Developer&#039;s Handbook: developing web-sites, exploring own imagination | CSS, Color Tools, SEO, Usability etc. Vitaly Friedman's The Web Developer's Handbook creativity | css galleries & showcases | color tools | color schemes, palettes | color patterns | fashion: colors selection | color theory | royalty free photos | css daily reading | web design daily reading | css layouts | css navigation menus | css techniques | css: software & Firefox Extensions | css-web-tools & services | html-web-tools & services | accessibility checkers | miscellaneous tools | ajax | javascript | DOM | fonts | typography | RSS | CMS | blogging | specifications | usability & accessibility | add a link (free) | seo tools | seo references | howtogetthingsdone | freelancers resources | web2.0 | 2read Advertise here! creativity css: selected showcases css galleries & showcases color tools color schemes, palettes color patterns fashion: colors selection color theory royalty free photos specifications usability & accessibility add a link (free) seo tools seo references howtogetthingsdone freelancers web 2.0 2read: this week

HTML Color Codes

Related: