CSS-Tricks
A proposal to drop browser vendor prefixes
Interesting idea by Felipe G on using a new at-rule, @-vendor-unlock, to tell the browser to use it's experimental implementation of any particular property, rather than using a vendor prefix on that property. Unfortunately at this point, even if you could get all the browsers on board, you'd need to use this and vendor prefixes to get deep support, which makes the problem worse. What we really need is for all browsers to implement auto-updating so eventually "supporting older browsers" is something we can look back and laugh at.
Direct Link to Article — Permalink
A proposal to drop browser vendor prefixes is a post from CSS-Tricks
Digging Into WordPress 3.3
Digging Into WordPress (the book) is now updated to v3.3. Includes new chapters specially on what's new in 3.2 and 3.3, all the rest of the chapters tightened up and refreshed, better internal hyperlinking (in the PDF), and more. It's a free update (PDF) to all previous buyers. New print copies are on order and will be available soon.
Direct Link to Article — Permalink
Digging Into WordPress 3.3 is a post from CSS-Tricks
ShopTalk Episode 4
Dave, Jonathan Longnecker, Nate Croft and I talk shop. Topics include website building apps, where to start designing, when not to design for modern browsers, and more.
Sponsored by LessAccounting.
Direct Link to Article — Permalink
ShopTalk Episode 4 is a post from CSS-Tricks
New Poll: In The Next 10 Years, Will We See CSS Competitor?
What do you think folks? Is a new language going to come along in the next ten years that deals with layout / style / design and unseat CSS? Or at least give it a run for its money?
You should vote not based on if there will be any attempt at it, which there certainly will be and already has. But instead if you think one of those attempts will actually make it into native support by a browser with significant market share and see a significant number of web workers building web sites in it.
Poll is in the sidebar (or, down pretty far if on a small screen).
New Poll: In The Next 10 Years, Will We See CSS Competitor? is a post from CSS-Tricks
Star Ratings With Very Little CSS
Star ratings are one of those classic UX patterns that everyone has tinkered with at one time or another. I had an idea get the UX part of it done with very little code and no JavaScript.
The markup uses the unicode entity for a star (☆) right in it. If you have a UTF-8 charset that should be no big deal. Alternatively you could use ☆ (Calculator for that kind of thing). You could use as many stars as you like:
<div class="rating"> <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span> </div>Now we need to flop out that "hollow" star with a "solid" star on hover (Gallery for finding those sorts of characters). Easy, just drop a pseudo element of a solid star (★) over it on :hover
.rating > span:hover:before { content: "\2605"; position: absolute; }Just by virtue of being it being absolutely positioned, the top: 0; left: 0; are implied (in modern browsers, anyway). So the solid star just sits directly on top of the hollow star. You could even change the color or size if you wished.
But what we have so far only works on individual stars. The UX pattern demands that all the stars be filled in. Fo instance, if we hover over the 4th star, the 4th star becomes solid, but also the 1st, 2nd, and 3rd.
Through CSS, there is no way to select a preceding child element. However, there is a way to select succeeding child elements, through the adjacent or general sibling combinators. If we literally reverse the order of the characters, then we can make use of the general sibling combinator to select all the stars that appear before the hovered star visually, but after the hovered star in the HTML.
.rating { unicode-bidi: bidi-override; direction: rtl; } .rating > span:hover:before, .rating > span:hover ~ span:before { content: "\2605"; position: absolute; }That's it! The whole star ratings UX pattern with very little code. Here's the entire bit of CSS to make it work:
.rating { unicode-bidi: bidi-override; direction: rtl; } .rating > span { display: inline-block; position: relative; width: 1.1em; } .rating > span:hover:before, .rating > span:hover ~ span:before { content: "\2605"; position: absolute; }And here's a Dabblet if you wanna mess with it.
Actual UsageChances are, JavaScript is going to be involved with rating stars anyway. When a user clicks a star, the rating is reported back via Ajax, and the widget itself gains a class to permanently display their selected number of stars. With JavaScript already involved, wouldn't it be OK to lean on it for flip-flopping classes around on the stars to make them work? If your app is absolutely dependent on JavaScript to work, then sure, that's fine. If you are interested in building a website that still works without JavaScript, then these Star Ratings are going to need more work. You should look into Lea Verou's example which uses radio buttons, which could be a part of a form that can be submitted to "rate" whatever it is without JavaScript.
OthersAfter first sharing this on Twitter, a couple of other folks took a crack at it in slightly different ways. @dmfilipenko's Dabblet. @mprogano's Dabblet
Star Ratings With Very Little CSS is a post from CSS-Tricks
Real-World CSS
A very serious not at all tongue-in-cheek gallery of CSS3 techniques that poo-poos the fancy in favor of the practical.
Direct Link to Article — Permalink
Real-World CSS is a post from CSS-Tricks
Better Box Sizing
Paul Irish suggests universal selector to apply border-box box-sizing to every element. I've been wanting to try this forever as this box model is, in my opinion, just better. Imagine elements with percentage widths and pixel padding that doesn't result in disaster.
Direct Link to Article — Permalink
Better Box Sizing is a post from CSS-Tricks
Firefox 10
...is now a stable release. It's notable because it's the first release with it's own built in developer tools (video overview). It's all HTML/CSS for now (not a Firebug replacement) but they are nicely designed and a great first step for a product that really should be in-house. Also, CSS 3D transforms! After you've upgraded, check out this demo using -moz-element and the just-now-supported 3D transforms.
Direct Link to Article — Permalink
Firefox 10 is a post from CSS-Tricks
Poll Results: Internet Connection Speed
In this latest poll, I asked people to test their own internet connection speed then vote in the poll based on their result. The speed choices ranged from (what I would consider) blazingly fast, to mediocre, to nearly unusably slow. I would have guessed a bell curve, with most people having mediocre speeds and just a few on the edges of extreme fast/slow. We didn't get that at all.
The results show a pretty even distribution across all the choices.
Interesting, no? If we take anything from this, it should be that we can't assume anything about what peoples internet connection speed is. There is a pretty darn sizeable group of folks with very slow internet. Optimizing our sites to load fast makes a very big difference to those folks. Whether they actively think about it or not, they'll be much more likely to visit and stay on your fast loading site than a competitor's slower loading one.
New poll soon.
Poll Results: Internet Connection Speed is a post from CSS-Tricks
Twitter Bootstrap 2.0
If your web app doesn't look or work as well as Bootstrap does out of the box, it's time to have a pretty serious discussion with your team about why.
Direct Link to Article — Permalink
Twitter Bootstrap 2.0 is a post from CSS-Tricks
1000px Grid for Responsive Web Design
To figure out your grid width percentages for a fluid design, you start with a fixed design and divide the column widths by the container width. Elliot Jay Stocks calls for us to stop the self-torture and use 1000px for the container, so the math is super easy.
Direct Link to Article — Permalink
1000px Grid for Responsive Web Design is a post from CSS-Tricks
Pictos Server
I've long been convinced icon fonts are awesome, but Drew Wilson's new service (and article I'm linking to). Think they use unsemnatic markup? Apply them via pseudo element. Worried some screen readers still read those? Not if you use aria-hidden="true" or map them to an unused plane of unicode characters. Too heavy weight? Build your own icon font and serve only what you need with this service.
Direct Link to Article — Permalink
Pictos Server is a post from CSS-Tricks
Responsive Design Testing Bookmarklet
Bookmarklet by Benjamin Keen which automates an idea by Lennart Schoors where the current page is loaded into a bunch of differently sized iframes, so when working on a large monitor, you can see what a design looks like at a bunch of different smaller sizes quickly and all at once.
Direct Link to Article — Permalink
Responsive Design Testing Bookmarklet is a post from CSS-Tricks
ShopTalk Episode 3
Where Dave and I are joined by Chris Eppstein. Sponsored by LessAccounting and United Pixelworkers (who are offering a 10% discount on shirts with coupon code "shoptalk").
Direct Link to Article — Permalink
ShopTalk Episode 3 is a post from CSS-Tricks
Animate to an Inline Style
You already know that inline styles are "bad practice." Inline styles aren't reusable like CSS in separate files is, and thus, inefficient bloat. Unless of course, when it isn't. There are some instances where inline styles make perfect sense. Perhaps you have an application where user's pick their favorite color, and then you set the background of the body to that. Using an inline style in that case is actually more efficient than external CSS, since it's specific to one user and one element.
Now let's say you want to animate to a value set in an inline style. Say you want to animate a progress bar. You start at zero, and need to go up to any arbitrary value. Perhaps a call to the server tells you how complete an upload is and you set the value from that.
In a post I did nearly a year ago, I lamented that you can't animate to an inline style. You can't declare a keyframe in inline styles and you don't know what final value to animate to in the external CSS. Alas I was wrong, as I didn't know about this bonafide little CSS trick.
<div class="progress-bar"> <div style="width: 75%">Upload is 75% complete.</div> </div>Here's the trick: just omit the to or 100% declaration from the @keyframe:
@-webkit-keyframes progress-bar { 0% { width: 0; } } @-moz-keyframes progress-bar { 0% { width: 0; } }Then you call the animation on the progress bar:
.progress-bar > div { -webkit-animation: progress-bar 2s; -moz-animation: progress-bar 2s; }And just like that, the progress bar will animate itself up to the value set by the inline style.
Here's a Dabblet if you wanna mess with it.
Special thanks to Michael Paryna who emailed me about this and got me to give it a try.
Animate to an Inline Style is a post from CSS-Tricks
Custom Fonts in Emails
A reader writes in:
Would it be possible to draw an entire typeface in CSS to be sent in emails? Our company needs to send out emails to about 20k people to introduce a new brand that we are launching. The emails will be in HTML/CSS. My CEO is very specific about the type of aesthetic he wants to achieve, and this includes using a typeface that is not native to either Mac or Windows computers. We do not want to use images in our email.
First off, it's pretty cool your CEO cares about type and aesthetics at all. It's usually a good thing to have the person steering the ship care about beauty and details down to that level. Let's consider the options.
The first thing that comes to mind in custom fonts these days is @font-face. The browser support for it is pretty darn good. Unfortunately, browser support isn't what we need here, it's email client support. According to some research by Campaign Monitor, @font-face is only working Apple's Mail.app and the Mail app on iOS. You could try to make the progressive enhancement case to your CEO, but at that low level of support might be a tough sell.
Another thing you mentioned was trying to recreate the font through CSS somehow. Maybe something like this. I've even played around with this concept a little bit specifically with the idea of image-free emails in mind. This is the realm of big-pixel-art though. Recreating a font pixel by pixel with no anti-aliasing, as you are surely aware, is a fool's errand.
In reality I think there are two solutions.
The first is to reconsider this sentence: "We do not want to use images in our email." Why not? It seems like you are OK with sending HTML emails since you're specifically looking for clever solutions and text emails are capable of very little cleverness short of ASCII art. People use images in emails all the time. Admittedly, the fact users often have to specifically choose to view them is a bit of a turn off, but using proper ALT text on the images makes the email still work even if they never do that.
The second is to give up on this custom font in email thing. Not to sound defeatist here, but your branding will not be ruined by the lack of a specific typeface in an email. Anywhere where you all agree it is critical (e.g. a slogan?), use an image, otherwise, use a nice readable font that works OK in pairing with your brand typeface and move on with more important tasks.
Personally, I think I'd go with @font-face despite the current low support. Actively developing what you want to work helps build the desire momentum needed to get product vendors (in this case email clients) to improve their products and give us better CSS support.
Custom Fonts in Emails is a post from CSS-Tricks
Burst Title
During the previews for a movie I saw recently, there was an advertisement for an Oprah-related something or another. I wasn't paying attention because I was trying to get out my phone so I could snap a picture of it. Which I failed to do. There was these neat title screens that I thought would be fun to recreate with CSS. They looked like... well they looked like this:
View Demo Download FilesTurns out you can do it rather semantically. Just a header tag with an anchor link inside. Admittedly, it would be cool to do it with just the header tag but I wasn't able to figure out a way to get the layers all right with the text on top without the extra element.
<h1><a href="#">CSS-Tricks</a></h1> h1 { text-align: center; color: white; text-transform: uppercase; padding: 1px; font-family: 'Raleway', cursive; font-weight: 100; position: relative; background: -webkit-linear-gradient(left, black, #eee, black); background: -moz-linear-gradient(left, black, #eee, black); background: -ms-linear-gradient(left, black, #eee, black); background: -o-linear-gradient(left, black, #eee, black); } h1:before { content: ""; position: absolute; left: 50%; top: -50px; width: 600px; margin-left: -300px; margin-top: -220px; height: 600px; background: -webkit-radial-gradient(50% 50%, ellipse closest-side, #444, black); background: -moz-radial-gradient(50% 50%, ellipse closest-side, #444, black); background: -ms-radial-gradient(50% 50%, ellipse closest-side, #444, black); background: -o-radial-gradient(50% 50%, ellipse closest-side, #444, black); z-index: -1; } h1 a { background: black; display: block; padding: 20px; text-decoration: none; letter-spacing: 30px; color: white; }I listed out all the vendor prefixes here because using them is required in "real" usage and I worry about people copying and pasting pseudo code. But if you want to play around with this and don't want to deal with all that, the Dabblet demo doesn't need them as it uses Prefix Free.
I also added some animations to the demo just for fun.
Burst Title is a post from CSS-Tricks
CSS1k
Back in the day, the CSS Zen Garden was a place to showcase the power of CSS. A single page was redesigned in vastly different ways with no change to the HTML. The CSS1k project (head up by Jacob Rask) is in that same vein only you are limited to only 1k of CSS. Fun, but the purpose is to get you thinking about how to be efficient and size economic with CSS.
Direct Link to Article — Permalink
CSS1k is a post from CSS-Tricks
ShopTalk Episode 2
In which we talk shop with guest Paul Irish. Sponsored by LessAccounting.
Direct Link to Article — Permalink
ShopTalk Episode 2 is a post from CSS-Tricks
SpriteRight Giveaway
There is a new Mac app called SpriteRight for doing CSS sprites that is pretty darn nice. I'm a fan of both SpriteCow (beautiful interface, design your own sprite) and SpriteMe (automatic combining of sprites, gives you real CSS). I feel like SpriteRight hits the nail on the head by combining the best features of both of these tools, doing it better, and doing more.
Here's their intro video:
It's normally $9.99, on sale for $4.99, but if you want to get it for free, I have some codes you can redeem in the Mac App Store. I will send the first five folks who record an audio question for ShopTalk and send it in. Doesn't even have to be a question, could just be a topic or hot tip you'd like to hear us talk about on the show.
SpriteRight Giveaway is a post from CSS-Tricks
Pages
Main menu
Recent Projects @Quevin
Other Websites Using Drupal
Drupal & CMS News
How-to's & Tutorials
@Quevin's Tweets
- Quevin: After an hour of trying to find out how to edit my.cnf in MAMP Pro 2.0.5, this occurs to me. Yep. So easy... http://t.co/l6Df5I1C
- Quevin: Now accepting new projects. http://t.co/ZLDJUprP
- Quevin: @mrf @wizonesolutions thanks for the Denver #DrupalCon weather wear advice. Needing Drupal beanie and scarf schwag.
- Quevin: Trouble w/ Twitter to your Facebook wall? Same. This help article does help: https://t.co/ROSM2beA http://t.co/uYDpoMPf
- Quevin: @MerlinPM thanks Frank and Dave for the drinks at Thirsty Bear in San Francisco! #ProjectWizards


