CSS3 Patterns Gallery
lea.verou.meAs a technical demo they're great. In practice though, I wouldn't recommend using these techniques because:
- Many are completely broken in FF
- Crashed my FF (19.0.2) and strangely sent my GPU fan into overdrive
- These techniques hurt performance badly. In the case of gradients
the browser has to first generate the bitmaps
from the gradient definitions, apply any clipping/masks
and then composite any other overlaying elements.
This is far more taxing than simply grabbing a
bitmap and painting into a region.Agree, they're great for mockups though as it's really easy to change the colours rapidly. Also good for doing things like animation of gradients.
"amazing"? These look terrible and would make any website look like a throwback from Geocities.
Neat that it's done with CSS3, not practical for any real purpose though.
All it'd take to make most of these usable is finessing the colors a bit so they don't jump off the page like they do here. It's definitely possible to make the patterns more subtle while retaining the shape effects. I viewed the page as a nifty demonstration of CSS-based patterns. Actually implementing the appropriate colors with these is left as an exercise for the reader.
According to my laptop's cooling fan color palette is the least of the issues here. I'm pretty sure that roasting your users' CPUs to render a background texture is considered poor form.
I acknowledge the performance issues. I was responding, however, to a comment about what these make the site look like.
What? I think you might have some issues there. These render instantly on my phone and on my Nexus tablet.
Notice how the site uses a png noise image as background and none of the css3 backgrounds.
Most are bad yes, but what if you could successfully replace one of those[1] in CSS. That would be a very good optimization hack.
[1] http://subtlepatterns.com/
EDIT: Or at least it seems. Maybe rendering as much details in the background with CSS is worse than just displaying repetitively a simple png.
I can see this being used: http://lea.verou.me/css3patterns/#lined-paper
I agree that they look terrible. It felt like I was thrown back to Windows 3.1 and Windows 95 tiled backgrounds. Trippy.
To me, these are amazing in the same way fingernails on chalkboard are amazing. Every time someone nicked the chalkboard with their fingernail in school, I felt as if someone was ripping my spine out. And every time I clicked one of those circles, I felt like someone was ripping my eyes out.
Nice, but oh my poor Firefox. What's wrong with images as bg?
Some numbers:
The one with hearts is 944 bytes (css file), 232 bytes gzipped (with 7zip), 304 bytes as gif (Photoshop. Can be smaller with hand optimizations. Need extra css code to tile as bg)
Just a tech demo IMO.
This site completely borked by firefox. Had to close and restart my browser to get out of it.
> What's wrong with images as bg?
1. Give a content block a raster background with a pattern including lots of pixel-perfect high-contrast edges (precisely the thing there are lots of in these demos!)
2. Visit the page on a mobile device, and tap to fit.
3. Horrible antialiasing ensues. (Not to mention what happens when you zoom in further.)
"CSS (vector) backgrounds" do have their use, and it's pretty much the same use as "vector icons"/"icon fonts" have: making things that look good at arbitrary scale+DPI.
"The one with hearts is 944 bytes (css file), 232 bytes gzipped (with 7zip)"
Did you measure the compressed size on its own or as a delta inside a larger CSS file? The pattern is going to share at least a part of its dictionary with the rest of the CSS file if sent deflated.
Is it trivial to animate these? For example how easy would it be to have one of the rainbow-bokeh bubbles slowly move upward ?
Yes, it would be trivial. In most cases though (including your example) you could achieve the same effect by simply animating a 32-bit PNG.
A lot of these look great :-) If only they worked in IE 7, 8 and 9 they could be used in real projects...
I guess gmail isn't a "real project" then...
Yup - just blocks of color for me :)
I do not like theese backgrounds, some of them really hurt my eyes.
I prefer these http://subtlepatterns.com/ ...I know they are just png, but works and look better.
Calm down, guys. As stated on her site, these are purely experimental. This page has also been up for a few years at this point.
They look like crap (not only the color, but also the jagged edges), the performance is also crap... I don't know, sometimes I think these hipster web devs are getting too much attention nowadays for things that aren't that complicated or innovative in comparison to, say, many things c++ programmers face on daily basis.
Only IE+? No doubt because IE is so ridiculous behind the other browsers in HTML5 support. I can't believe even Firefox 3.6 which was released in like 2010 had proper support for CSS3 that only IE10 has now, from all the IE versions.
Bad performance and support only for IE10+ will put these out of consideration for many. I think the real world appeal of these will be limited to say the least.
These look great, but performance is really poor.
Could you explain this? I'd figure the performance would be greater than using an repeating image for a background.
Performance is far worse because this is the equivalent of a procedural texture. With a tiling bitmap the computer simply fetches the file, then paints the pixels into a region.
With a definition such as:
The browser first parses the CSS, then generates the actual bitmap data for this definition in memory then finally paints the pixels into the correct places. The in-memory bitmap generation is far more taxing than simply tiling an existing bitmap.- radial-gradient(closest-side, transparent 0%, transparent 75%, #...Then there is the issue of dynamic CSS which may cause reflow which will in turn probably require more dynamic bitmap generation.
One interesting thing is done while building iOS app: png images are reencoded to make them more efficient. What is done, that alpha value is premultiplied, but the more interesting thins is that bytes are rearranged from RGB to BGR . This is done to match the layout of the iPhone display, so mapping from image is even faster.
Good as an experiment, but I honestly wouldn't use any of these backgrounds.
Nice. Please make the Escape key work to close the pattern popup!
Real tartan doesn't have diagonal lines like that. Sorry :)
It looks good, until you apply to background.
Why exploiting CSS3 when SVG will do?
not working for me with css supplied.
need to improve performance...