jacquico.com was making the Twitter rounds today. Give it several minutes to load but its an extremely interesting idea. Not sure I’ve seen a site powered by Google Maps before. Cute illustration and animations too.
Category Archives: Web Development
background-size property overwritten by background shorthand by Firefox
As I start to use new CSS3 properties more often new issues are arising that I didn’t have to deal with before. Building out a new responsive site now that is using retina images for the mobile site so I’m using the background-size property extensively. I ran into a bug in Firefox 11 where in some situations the property was ignored.
Here’s an example of the code that did not work in Firefox:
112 113 114 115 116 117 118 119 120 121 122 123 124 125 | .author:after { background-size: 30px 30px; content: ""; height: 30px; padding: 0; position: absolute; right: -32px; top: 0; width: 30px; } .author-brian .author:after { background: url(/img/avatar-brian.png) right top no-repeat; } |
Turns out, using the background shorthand was overwriting the size. Adding the background-size property to the more specific author declaration fixed the issue.
It looks like this is actually correct behavior according to the spec. Using the shorthand overwrites all other background properties. From the Standarista site’s notes on CSS3 background properties:
If you use the background shorthand and fail to declare any of the individual properties that make up the shorthand, those properties will revert to their default values [...].
I thought it was time to learn the more detailed background shorthand that includes the new properties like background-size and background-clip. However, the W3C’s spec for it isn’t actually supported by seemingly any browsers yet. Here’s what the new shorthand declaration of the code should be:
123 124 125 | .author-brian .author:after { background: url(/img/avatar-brian.png) right top / 30px 30px no-repeat; } |
Unfortunately, that valid line of CSS breaks in every browser I tried it on and results in the image not displaying at all. I ended up needing to define the background-size property separately after the shorthand declaration:
123 124 125 126 | .author-brian .author:after { background: url(/img/avatar-brian.png) right top no-repeat; background-size: 30px 30px; } |
The actual code will vary depending on what you’re doing but the important thing is to not forget to include the other background properties even if you’re not specifying them in your shorthand.
A Fix for the iOS Orientation Change Zoom Bug
Code from the guys at the Filament Group that fixes that annoying bug where iOS incorrectly zooms your site when you flip from landscape to portrait and vice versa.
Color Thief
From the creator of the original javascript lightbox comes Color Thief, a jQuery plugin that analyzes the colors in a given image and returns the dominant color and the color palette. Has some incredible usage possibilites both from from a design angle and also in improving usability. Definitely looking for an excuse to use this on a project.
Content Choreography – Content Strategy in a Responsive World
Trent Walton has written (and designed) a great (and beautiful) article on dealing with content in responsive web designs that adapt to the width of visitors’ browsers. Content Choreography is a good discussion of content organization, changing designs too much between various widths, and the workflow needed when creating responsive web sites. Definitely a must read for any designer or developer.
MediaElement.js HTML5 Video Player
Great JavaScript script for HTML5 video and audio players with a Flash fallback. Includes plugins support and skins. Visitors get a good and consistent media experience regardless of what browser they’re using.
Screen Resolution != Browser Window
Something I’ve been preaching for years, but just because your web analytics say everyone visiting your site has as screen resolution of 4,000 pixels by 4,000 pixels doesn’t actually mean their browser is that size. Screen resolution size is not the same as browser window size. Most users, including myself, surf the web with their browser window at only a fraction of their screen resolution.
Thematic Consistency and URL Design
Thematic consistency means no matter what device you’re using, the same content should pull up when you hit a URL.
Responsive web design trending, mobile first still lagging
Jason Grigsby of CloudFour has posted an interesting (as always) article on the latest trends in mobile first responsive web design and the numbers show the majority of responsive designs provide very little, if any, file size savings for their mobile versions.
CSS transitions & media queries
Seen it happen accidentally since nearly the beginning of the responsive web design movement, but great writeup on how CSS3 transitions can add some fun to your responsive designs.
