CSS Seesaw
It’s Friday night, so not a big one tonight.
I thought I would have a quick play with CSS transitions, and nothing seemed a better demonstration than a seesaw.
Here it is (warning: this only works in Webkit browsers at the time of writing):
http://playground.matthewbutt.com/seesaw.htm
This little animation uses two transitions: one to tip the seesaw back and forth, and the other to roll the ball from one end to the other. There were only two slightly complex matters here: I needed to brush up on my A-level trig to get all the distances right, and a little sleight of hand was in order to create the triangular pivot (fire up Firebug if you want to see how I did it).
There are a few small bugs: poor aliasing, and a ghost top border on the seesaw element, but they can wait for another day.
And now, goodnight!
Constructivism Part II
Following on from yesterday’s work, another experiment today, and this time I chose a real piece of constructivist design to copy:

The simple lines of this image make it fairly straightforward to lay out in HTML and CSS:
http://playground.matthewbutt.com/why.htm
Here’s how I did it:
My h1 contains the text ‘WHY?’. The h1 is a 200px square absolutely positioned on the page.
To create the semi-circle, I’ve given this element two background gradients: the first uses a linear gradient to draw two blocks of colour on the page: the upper block is solid parchment colour, whilst the lower block is transparent.
In Mozilla this is marked up like this:
-moz-linear-gradient(top, #F1ECD9 100px, rgba(241, 236, 217, 0) 100px)
In Webkit is takes this form:
-webkit-gradient(linear, 0 100, 0 200, from(#F1ECD9), color-stop(0, rgba(241, 236, 217, 0)), to(rgba(241, 236, 217, 0)))
You’ll see that I’ve defined the transparent colour as rgba(241, 236, 217, 0) rather than simply transparent; I found that using simple transparent gave me some ghosting, which is clearly not the intention.
Underneath this gradient is a second background, which this time defines a radial gradient:
-moz-radial-gradient(100px 100px, circle cover, black 100px, #F1ECD9 100px, #F1ECD9 200px)
-webkit-gradient(radial, 100 100, 100, 100 100, 200, from(black), color-stop(0, #F1ECD9), to(#F1ECD9))
In each case, this draws a 100px-radius black circle, followed by an area of parchment colour.
The lipsum content with the inverted red semicircle is coded in a similar way, although I could do away with the linear gradient, as my p tags give me the perfect hooks for a parchment-coloured background without worrying about gradients. The text is shifted down with a simple padding-top rule, and the red line down the side is an equally straightforward border-right.
The large red square doesn’t actually exist: it’s an :after pseudo-element on the body tag, which is then sized, positioned and rotated. I had to give it content(' ') to get it to appear, but otherwise it’s pure smoke and mirrors.
Finally, the three 45° links were interesting to position:
They start off as three li elements arranged normally on the screen:
Next, I rotate the containing ul by 90° widdershins around its top right corner:
Finally, I rotate each li by 45° clockwise around what was originally its middle-right and is now its top-centre:
These are then positioned absolutely on the page.
And that’s my piece of constructivist CSS for the day.
I have one outstanding problem: the edges of my semi-circles are unpleasantly aliased. I’ve tried leaving a small gap between the colour stop points in the gradient to see if that helps, but the effect is pretty unsatisfactory. Any suggestions would be welcome!
Acknowledgments
Fonts
- Great Primer, which is one of the Fell Types digitally reproduced by Igino Marini
Sites
- Original image found at Essential Architecture
Look mum: no images!
One of the downsides of specialising is leaving behind areas of knowledge you used to love. As I have specialised in the programming side of web development, I have found myself getting further and further away from working with HTML and CSS, and letting my markup skills get rather rusty.
Of course, over the last couple of years, all sorts of exciting things have been happening with HTML and CSS, as browsers implement more features of HTML 5 and CSS 3, and the skills and techniques I used to be able to boast of are now anything but cutting edge.
So I thought I should do something about it, and there’s no better way to deal with something like this than to have a good play around. The following pages are rendered entirely using HTML and CSS; no images were harmed in the preparation of these pages.
Note: these pages render correctly in Firefox 3.6 and Safari 4.0.4. They probably don’t work in older versions and are most definitely NSFIE.
Landscape
First, then, I thought I would have a bit of a play with web fonts, gradients and transformations. Here’s the result:
http://playground.matthewbutt.com/landscape.htm
It took a little adjustment to get the rays of sunshine correctly positioned: the key was to position the transform origin at 50% of the height of the text.
Constructivism
Next I thought I would try my hand at a little faux-constructivist design. The simplicity and clear colours of constructivist design are perfect for online material, but the jaunty angles have always posed a major problem: either render the text as images, or give up. With CSS 3’s transformations, this is no longer a problem, and there’s scope for a Russian revival:
http://playground.matthewbutt.com/construction.htm
Again, getting everything to line up took a little getting used to, and it boiled down to the same issue: getting the transform origin of every element in the same place, and then rotating around that point.
A real-world example: Magazine’s Touch and Go
Ok, my constructivist sketch isn’t exactly high design, so I thought I would find something that had already been done, and have a go at copying it.
Here is the cover of Magazine’s 1977 debut single, Touch and Go:

And here is a quick HTML version:
http://playground.matthewbutt.com/magazine.htm
The only advanced technique here is the use of web fonts, although I’ve made liberal use of the :nth-child pseudo-class to apply styles to the coloured panels. I have to confess to using a few non-essential spans for this one, but I think the result is pretty pleasing for an image-free page.
And that’s my lot for today. There’s plenty more excitement in the latest implementations of HTML and CSS, so I’ll post some more experiments when I have a moment.
Acknowledgments
Fonts
- Landscape and Construction use Blackout Midnight by the League of Moveable Type
- Magazine uses Great Primer, which is one of the Fell Types digitally reproduced by Igino Marini
Books
- Walsh, Gavin (2006). Punk on 45: revolutions on vinyl 1976–79. London, Plexus. ISBN-13 978-0-85965-370-1













leave a comment