Sliced text effect

I am a huge fan of Terry Pratchett’s discworld books. At one point in the series Death, with his scythe so sharp it can cut sound, manages to slice words on the page into separate letters. The resulting effect on the page looked strange but brilliant. I thought I would try and recreate that effect. And here is what I came up with.

I am afraid the technique is a little manual so it requires some playing about with pixels. So this is not really feasible for variable length text. Unless you can work something out that I could not of course. Before we look at the CSS you will want to get familiar with the markup. Otherwise you will not understand the counter rotations among other things.

The base CSS is pretty simple. It just involves positioning the elements correctly. The left and top values are the ones you need to tweak to get your text in the right place. This can be tricky because you need two copies of your text and you must adjust both separately.

The rotation of -30deg in the code above is to counteract the rotation of the element that clips the text (div.line). The CSS for the clipping element is a little more complicated. But all you have to worry about are the lower properties. These involve more top / left positions and some color choices.

So all you have to do is set up your text, position it in an inspector by adjusting the left / top values and color the background. You can also style your border with the last chunk of CSS. A live demo of this is available on jsFiddle. Feel free to have a play around with it. And please leave a comment with any thoughts you may have.