Slicing your Photoshop layers to web elements is indeed tiring. And if you aim to translate all those Photoshop layer effects into CSS, it could be even more tedious. “What CSS properties should I use to replicate these effects?” and “What vendor prefix to include?” would probably be some of the questions that might pop-up in your mind during the process.
Recently, we came across a tool called CSS Hat. It’s a Photoshop plugin that turns your layer effects into CSS3. Let’s take a look at how it works.
The Features
As mentioned, CSS Hat translates your Photoshop effects, like Gradient Overlay, Drop Shadow, and Inner/Outer Glow, into standard CSS syntax in only a few clicks.
CSS Hat also supports translation into CSS-Preprocessor syntax like Sass, SCSS, LESS, and Stylus.
One thing to note, however, is that the generated output of LESS code uses LESSHat mixins library, CSS Hat’s sibling. So, to ensure that you can use the output, download the library, and include this line at the top your LESS stylesheet.
CSS Hat uses Compass to generate CSS3 mixins for SCSS or Sass.
Unlike the previously covered CSS3Ps, which generates code output on the Cloud, CSS Hat on the other hand runs the process locally in your machine. To see more how this plugin works in action, watch the following video.
As mentioned, CSS Hat translates your Photoshop effects, like Gradient Overlay, Drop Shadow, and Inner/Outer Glow, into standard CSS syntax in only a few clicks.
CSS Hat also supports translation into CSS-Preprocessor syntax like Sass, SCSS, LESS, and Stylus.
- @import "lesshat.less";
Output Option
There are several options included to allow customization of the output. You can add comment to styles generated from the layer effect, include the vendor prefix, translate the layer dimensions intowidth and height property, and wrap the style rules in a class selector.