Checkerboard, striped & other background patterns with CSS3 gradients

Screenshot of the CSS3 patterns I came up withYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the ugly verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more.

View demo (Works in Webkit, Firefox 3.6+, Opera 11.50+ and IE10+)

The main idea behind the technique is the following, taken from the CSS3 Images spec:

If multiple color-stops have the same position, they produce an infinitesimal transition from the one specified first in the rule to the one specified last. In effect, the color suddenly changes at that position rather than smoothly transitioning.

I guess this makes it obvious how to create the tile for the stripes (unless you’ve never created a striped background before, but teaching you this is beyond the scope of this post). For example the gradient for the horizontal stripes is:

background-color: #0ae;
background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent));
background-image: -moz-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);
background-image: -o-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);
background-image: linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

Why transparent instead of the actual colors we want? For flexibility. background-color serves two purposes here: Setting the color of half the stripes and serving as a fallback for browsers that don’t support gradients.

However, without anything else, the tile will occupy the whole container. To control the size of each tile, you can use background-size:

-webkit-background-size: 50px 50px;
-moz-background-size: 50px 50px;
background-size: 50px 50px;

To create the picnic-style pattern, you just overlay horizontal stripes on vertical stripes.

The hardest one to figure out was the checkered pattern. It consists of two 45° linear gradients and two -45° linear gradients, each containing ¼ of the dark squares. I still haven’t managed to think of a way to create a regular checkerboard (not at 45°) without needing an unacceptably large number of gradients. It will be very easily possible if conical gradients start being supported (currently they’re not even in the spec yet).

Can you think of any other popular patterns that can be created with CSS3 and no images? If so, let me know with a comment. Cheers! :)

Added afterwards: Other patterns

There are far more pattern designs possible with CSS3 gradients than I originally thought. For more details, see this later post.

  • http://pepelsbey.net/ Vadim Makeev

    I really like the idea of this patterns, but as far as I know -o-linear-gradient and linear-gradient will never happen with this kind of syntax. So they are kind of useless here, but thank you that you care about browsers other than Webkit ;)

  • http://leaverou.me Lea Verou

    I thought that was the standard syntax for CSS gradients, even after the recent changes. Which part is wrong?

  • http://twitter.com/dstorey/ David Storey

    The correct syntax is -o-linear-box-gradient and linear-box-gradient

  • http://leaverou.me Lea Verou

    Oh, I see. Changed :) Thank you both!

  • http://www.kbjrweb.com James Brumond

    Great post. I had never thought about using gradients like this.

  • http://christopherwilliamdesign.com Christopher William

    This is a really great idea!

  • http://codebix.com/posts/post/158836/Striped-and-Checkerboard-Backgrounds-Without-Images Striped and Checkerboard Backgrounds Without Images

    [...] striped and checkboard backgrounds with no images. Direct Link to Article — Permalink… [full post] Chris Coyier CSS-Tricks link 0 0 0 0 0 [22 [...]

  • http://blog.everymanhosting.com/web-design-articles-news/striped-and-checkerboard-backgrounds-without%c2%a0images/ Striped and Checkerboard Backgrounds Without Images | The Hostmaster’s Blog :: Web Hosting Tutorials | cPanel Guides | UK Unlimited Domain Web Hosting

    [...] Direct Link to Article — Permalink [...]

  • http://freelance.99spaces.com/2010/12/striped-and-checkerboard-backgrounds-without%c2%a0images/ 99spaces – Freelance » Striped and Checkerboard Backgrounds Without Images

    [...] the original post: Striped and Checkerboard Backgrounds Without Images Click here to cancel reply. [...]

  • http://weboldal-karbantartas.com/ tom

    only it bad IE…

  • http://zencodez.net Han Lin Yap

    eh, I can’t find anything about linear-box-gradient in google

  • http://my-stream.net/2010/12/striped-and-checkerboard-backgrounds-without%c2%a0images/ My Stream » Striped and Checkerboard Backgrounds Without Images

    [...] Originally posted from: Striped and Checkerboard Backgrounds Without Images [...]

  • http://www.daniloguedes.com Danilo Guedes

    Hey!!! very very nice!!! good job!

  • http://benackles.com Ben Ackles

    You mention IE, but I wish Firefox would get up to speed on CSS3 as well. Webkit-based browsers are smoking it!

    Nice trick! Great article.

  • http://leaverou.me Lea Verou

    Gecko (Firefox) supports all of the above patterns, and with better syntax.
    Webkit doesn’t support “more CSS3″, they just invent a ton of proprietary stuff and implement it before proposing them to the W3, so of course they’re first to implement the stuff they invented! But that stuff can’t be called “CSS3″, since it’s not in any specification (for the most part).

  • http://leaverou.me Lea Verou

    It was discussed in www-style, W3′s mailing list for CSS.

  • http://www.xanthir.com Tab Atkins

    linear-box-gradient() is not the correct name – dstorey (or maybe just one of the Opera devs) got confused on that. The current spec at dev.w3.org/csswg/css3-images is fully updated with the most recent edits.

    By the way, for the diagonal gradients, you can do them now. Angle gradients have always been supported, but they couldn’t be tiled well. Now, though, I’ve gone ahead and specced the repeating-*-gradient() functions that Moz invented, so you can do a good diagonal pattern, and the other repeating patterns are easier too, because you don’t need to use background-size to make them repeat well.

  • tibalt

    would anyone make a filter/behavior-hack for ie?)

  • http://leaverou.me Lea Verou

    Hmm, I changed the prefixless version back to linear-gradient.

    I didn’t use repeating-gradient cause there’s no Webkit alternative right now.
    What do you mean angle gradients have always been supported? I don’t mean a linear gradient with an angle, I mean this: http://farm3.static.flickr.com/2525/3689257349_f583ea9bf8.jpg
    I remember those being discussed on www-style recently, but I don’t think they’re supported yet by any browser. They would make checkerboard patterns really easy (just one gradient).

  • Arkkimaagi

    This is awesome here’s a little something I played with chrome:

    Just add this at the end of your css and check it in webkit.

    .checkered {
    background-image: -webkit-gradient(linear, 0% 100%, 100% 0%, color-stop(.33, #fff), color-stop(.33, transparent), to(transparent))
    ,-webkit-gradient(linear, 100% 100%, 00% 0, color-stop(.33, #fff), color-stop(.33, transparent), to(transparent))
    ,-webkit-gradient(linear, 0% 0, 0% 100%, color-stop(.5, transparent), color-stop(.5, #f00))
    ,-webkit-gradient(radial, 32% 37%, 10, 32% 37%, 11, from(#f00), to(transparent))
    ,-webkit-gradient(radial, 68% 37%, 10, 68% 37%, 11, from(#f00), to(transparent))
    ,-webkit-gradient(radial, 50% 63%, 10, 50% 63%, 11, from(#f00), to(transparent));
    }

  • Arkkimaagi

    Here’s a quick demo for your convenience. http://jsfiddle.net/Arkkimaagi/L97SA/

  • http://www.xanthir.com Tab Atkins

    Ah, kk, I didn’t realize what you were referring to.

    Yeah, angle gradients aren’t supported by anyone, and I don’t have any plans to add them to this iteration of Image Values. Maybe the next iteration.

  • http://leaverou.me Lea Verou

    Cool! Added to the article ;)
    Why only Webkit though? I’m pretty sure it can work in Gecko too, if you add its syntax.

  • http://zencodez.net Han Lin Yap

    Here is a triangle pattern.
    background-image: -moz-linear-gradient(30deg, #555555 40%, transparent 40%, transparent), -moz-linear-gradient(90deg, transparent 75%, #555555 75%), -moz-linear-gradient(-25deg, transparent 75%, #555555 75%)

  • Arkkimaagi

    I did not have time to do more, I’m sure it would work. I’m just too busy with the christmas and all. :)

  • Wayne

    I love the article, and plan to play with gradients much more, but this site looks like something is askew in all browsers especially IE8
    -W

  • http://rolling-webdesign.com Theo

    Neat idea, i would say very, very creative!

  • http://black-flag.net/css/20101227-2288.html 画像を使用せずにCSSのみで作るストライプ、チェック、ボーダーなどの柄や、ボックスの角を折り曲げた様な背景エフェクト。 | BlackFlag

    [...] ≫Checkerboard, striped & other background patterns with CSS3 gradients « Lea Verou [...]

  • http://blog.josemanuelperez.es/2010/07/techniques-optimize-web-sites/ Website optimization checklist

    [...] patterns and triangles can be made using CSS/CSS3. Not only do they reduce the number of requests, but they [...]

  • http://www.lomejordetijuana.com Roberto

    I’m gonna try it. Thanks.

  • http://anabelsoft.com/Blog/2010/12/30/background-stripes-patterns-css3/ Background Stripes & other patterns with CSS3 | Web Designers and Search Engine Optimizers

    [...] See how simple it is to do it by yourself! [Translate] [+] Share & Bookmark • Twitter • StumbleUpon • Digg • Delicious • Facebook [...]

  • http://spartanpixel.com/checkerboard-striped-other-background-patterns-with-css3-gradients/ Checkerboard, striped & other background patterns with CSS3 gradients « Spartan Pixel | News and much more
  • http://creativetweets.com/checkerboard-striped-other-background-patterns-with-css3-gradients/ Checkerboard, striped & other background patterns with CSS3 gradients | CREATIVE TWEETS

    [...] striped & other background patterns with CSS3 gradients – http://bit.ly/f7Z5HJ Posted in WEB DESIGN | December 31st, [...]

  • http://www.designstudio16.com saurabh shah

    Nice tutorial.
    You can also add some fallback for browsers which do not support these patterns so atleast some background will be there.

  • Agos

    Did you notice that your blog comments look horrible in Chrome?

  • http://www.devlounge.net/friday-focus/123110-go-big-or-go-home Friday Focus 12/31/10: Go Big or Go Home | Devlounge

    [...] – Checkerboard, striped & other background patterns with CSS3 gradients “What you might not be aware of, is that CSS3 gradients can be used to create many kinds of [...]

  • http://leaverou.me Lea Verou

    Yes, but I’m planning to redesign soon anyway.

  • http://leaverou.me Lea Verou

    There is a solid color fallback already.

  • http://braincube.us/ Max

    Hey, what about dotted pattern? It could be easily created with radial gradient I believe…
    And with multiple backgrounds it may be possible to have something like this http://www.premiumpixels.com/wp-content/uploads/2010/11/preview15.jpg

  • http://regexhacks.com/blog/2011/01/striped-and-checkerboard-backgrounds-without%c2%a0images/ RegexHacks :: Blog » Striped and Checkerboard Backgrounds Without Images

    [...] Direct Link to Article — Permalink [...]

  • Jivanshr

    Becoming well familier with css3 stuff……….they are really cool

  • Peter Klein

    Awesome

  • http://www.sixthsensemarketing.com.au/about/bradley-davis/ Bradley Davis

    Very cool idea.

  • http://gauravmishra.com/ Gaurav Mishra

    Very smart! :D

  • http://www.red-team-design.com/cross-browser-css-gradient-buttons Cross-browser CSS gradient buttons – Red Team Design

    [...] Gradient patterns thanks to @leaverou for its enlightening article about CSS3 gradients techniques [...]

  • http://proismy.name/css/css3_snippets/ <pro page=”9 вещей, которые ты не знал о CSS3″ />

    [...] Совсем недавно появилась идея создавать текстуры с помощью градиентов. Более подробно на эту тему можно прочитать тут: Lea Verou`s blog. [...]

  • http://leaverou.me/2011/02/checkerboard-pattern-with-css3/ Checkerboard pattern with CSS3 | Lea Verou

    [...] while ago, I wrote a post on creating simple patterns with CSS3 gradients. A common pattern I was unable to create was that of a regular, non-rotated checkerboard. However, [...]

  • http://swl-projekt.pl/css/1221-checkerboard-pattern-with-css3 SWL-Projekt » Checkerboard pattern with CSS3

    [...] while ago, I wrote a post on creating simple patterns with CSS3 gradients. A common pattern I was unable to create was that of a regular, non-rotated checkerboard. However, [...]

  • http://awesomebutuseless.com/designers-gone-wild/lea-verou-makes-background-patterns-with-css3-gradients/ Lea Verou Makes Background Patterns with CSS3 Gradients | Awesome But Useless

    [...] Here’s a neat trick. You take a background colour and then, with some CSS3 magic, add a background gradient. The trick involves something about repeating colour stops that alternate between transparent and semi-transparent. Checkout Lea’s post to see the variety of patterns you can generate. [...]

  • http://marie-ailloud.fr/blog/?p=144 Créer des motifs avec la propriété CSS3 gradient | Des souris et des plumes

    [...] carreaux, en échiquier, etc… Si cela vous intéresse, je ne saurai trop vous conseiller cet excellent article (en anglais, oui je sais) sur le blog de Lea [...]

  • http://twitter.com/SmashDeveloper Adel Miljkovic

    CSS3 is really the thing that started to change the way that web is built. No more images for some basic elements. Still I don’t like that I have to include a prefix for -webkit- -moz- and -o- :/

  • http://twitter.com/SmashDeveloper Adel Miljkovic

    CSS3 is really the thing that started to change the way that web is built. No more images for some basic elements. Still I don’t like that I have to include a prefix for -webkit- -moz- and -o- :/

  • http://www.silver-tab.com/?p=1045 CSS3 Progress Bars | Silver-Tab.com

    [...] I first saw and snagged this idea from Lea Verou. [...]

  • http://removals-cleaning.com.au FurnitureRemovalistsMelbourne

    Is there a workaround for Google Chrome they look funny on my computer.

  • http://twitter.com/dreamwind Nikolay Matsievsky

    Hearts demo doesn’t work in FF3.6

  • vara

    Great

  • http://leaverou.me Lea Verou

    Which pattern are you referring to and which version of Chrome? They look fine on mine.

  • http://leaverou.me Lea Verou

    Yeah, the author (Arkkimaagi) only used the -webkit-gradient syntax.

  • http://dev.blog.jollyscience.com/2011/02/24/css3-progress%c2%a0bars/ CSS3 Progress Bars « Jolly Science

    [...] I first saw and snagged this idea from Lea Verou. [...]

  • http://twitter.com/im_zeeshan Zeeshan

    thnku..very useful!

  • Chat

    topluchat for title tahns admin

  • http://www.topluchat.com Chat

    chat mi kurdissh chat mi ozaman topluchat beklerim

  • http://www.topluchat.com Kurdishchat

    thank you my friends

  • http://betamos.se/ Didrik Nordström

    Awesome!

  • Maddyflash

    not working in IE 8

  • Alexandre

    Not surprised… :D

  • http://leaverou.me Lea Verou

    Yeah, it’s not supposed to :)

  • http://blog.kowalczyk.cc/2011/03/06/linkdump-31-css3/ Linkdump #31: CSS^3. « Tomasz Kowalczyk

    [...] Checkerboard, striped & other background patterns with CSS3 gradients. Szachownica i inne "wzorki" wykonane w [...]

  • Anonymous

    Amazing. Thanks!

  • http://makecode.ru/2011/03/css3-progress-bars/ CSS3 индикаторы загрузки (прогрес бары)

    [...] Впервые эта идея пришла Лию Вероу. [...]

  • http://pulse.yahoo.com/_WERDBLOT3MYWKN75AHWLHNOQX4 Nica

    Is now working on Opera v11.10 ßeta (supports only linear gradients, as to this date). Good!

  • http://dev.blog.jollyscience.com/2011/04/02/speed-up-with-css3%c2%a0gradients/ Speed Up with CSS3 Gradients « Jolly Science

    [...] Verou with clever and practical background techniques. Also see Lea’s automatic gradients syntax converter [...]

  • http://www.smashingmagazine.com/2011/04/18/powerful-new-css-techniques-and-tools/ Powerful New CSS Techniques and Tools – Smashing Magazine

    [...] has only been tested on iPhone. Also make sure to visit more of Hakim’s CSS/HTML5 experiments.Checkerboard, striped & other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard [...]

  • http://redbey.com/?p=290 Powerful New CSS Techniques and Tools | redbey

    [...] Checkerboard, striped other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery. [...]

  • http://www.ewok.fr/blog/?p=432 Powerful New CSS Techniques and Tools « e-wok.fr, le blog

    [...] Checkerboard, striped other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery. [...]

  • Anonymous

    Excellent technique that’s really cool!

  • http://www.buildin9.com/?p=285 Powerful New CSS Techniques and Tools

    [...] Checkerboard, striped & other background patterns with CSS3 gradients You’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery [...]

  • http://www.ruturaj.in/powerful-new-css-techniques-and-tools/ Powerful New CSS Techniques and Tools | Ruturaj Pradeep Kohok | Your Web Advisor

    [...] Checkerboard, striped & other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery [...]

  • http://wpremake.com/powerful-new-css-techniques-and-tools/ Powerful New CSS Techniques and Tools | Remake Wordpress Theme

    [...] Checkerboard, striped & other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery</a. [...]

  • jandyme

    Hi, everyone! I find a distinctive cosplay site and
    I’d like to share it with you. The site includes such
    popular anime roleplays as Naruto, Angry Birds, etc.
    I like the toys on the site, cos it’s really nice
    with good quality, what surprises me is the low price
    and it doesn’t cost any freight fee. If you have any
    interest, please go with me!
    godoon . c o m

  • http://web-design.fenixhd.com/2011/04/21/powerful-new-css-techniques-and-tools/ Web Design » Blog Archive » Powerful New CSS Techniques and Tools

    [...] Checkerboard, striped & other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery [...]

  • http://www.iknowidea.com/designing-idea/powerful-new-css-techniques-and-tools/ Powerful New CSS Techniques and Tools | i know idea

    [...] Checkerboard, striped & other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery [...]

  • http://fairwayweb.com/css-techniques-and-tools FairWay Web Development » CSS Techniques and Tools

    [...] Checkerboard, striped & other background patterns with CSS3 gradients You’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery [...]

  • http://www.copyandprint.net/powerful-new-css-techniques-and-tools/ Powerful New CSS Techniques and Tools : Copy & Print Center

    [...] has only been tested on iPhone. Also make sure to visit more of Hakim’s CSS/HTML5 experiments.Checkerboard, striped & other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard [...]

  • http://www.39articles.net/new-advance-css3-techniques-and-tools/ New Advance CSS3 Techniques and Tools | 39Articles

    [...] Checkerboard, striped & other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery [...]

  • http://kulturbanause.de/2011/04/css3-hintergrundmuster-mit-css3-gradients-erzeugen/ CSS3-Hintergrundmuster mit CSS3-Gradients erzeugen | kulturbanause blog

    [...] Verou hat vor einiger Zeit auf Ihrem Blog ein sehr interessantes Experiment vorgestellt: Mit Hilfe von CSS3-Gradients hat sie Hintergrund-Kacheln erzeugt, die anschließend [...]

  • http://twitter.com/danyyel_san Carlos Daniel

    What about making a gradient with thw width being twice the height with Color 1-Color 2 and below another one with Color 2-Color 1 and repeat using background-size, eh? Would that make a checkered pattern?

  • http://leaverou.me Lea Verou

    I’m not sure I follow. Can you make a fiddle? (jsfiddle.net)

  • http://www.kabytes.com/diseno/patrones-con-degradados-en-css3/ Patrones con degradados en CSS3 | Kabytes

    [...] más información pueden visitar el artículo de Lea Verou (en [...]

  • http://twitter.com/danyyel_san Carlos Daniel

    (I wrote a good and long description and some code before this, but somehow, and I couldn’t get it back, it vanished into thin air (pixels?) T^T)

    You understand a lot more than I do, so I hope I’m not making any mistakes… =/

    Imagine two horizontal-striped gradients with their width being twice their height. The top one would be “Transparent|White” and the bottom one “White|Transparent” and the division would be made halfway through the gradient.

    I’ll try some code (most likely all wrong):
    .element {
    background: #000;
    background-size: 30px 15px, 30px 15px;
    background-image: linear-gradient(white 50%, transparent 50%, transparent);
    background-image: linear-gradient(transparent 50%, white 50%, transparent);
    }

    Would it work?
    I had a dowt about how to make 4 gradients…. Two on top and two in the line below (like the 45º checkered pattern). Could you help me out? :) It is probably missing in the code above since I don’t know how to……..

    5Mins Later….
    Okay, so I thought about it (and saw those links you posted below, and thought about adding this to the code above:
    background-position: 0 0, 0 15px;

  • http://qeqnes.wordpress.com/2011/04/27/powerful-new-css-techniques-and-tools/ Powerful New CSS Techniques and Tools « qeqnes | Designing. jQuery, Ajax, PHP, MySQL and Templates

    [...] Checkerboard, striped & other background patterns with CSS3 gradients You’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery [...]

  • http://leaverou.me Lea Verou

    No, that won’t work, and you can see why here: http://jsfiddle.net/leaverou/Nw8P4/
    It’s really quick to test stuff like that, no need for speculation :)

  • http://twitter.com/danyyel_san Carlos Daniel

    Thanks! ;) But how would I make the 4 gradients like de 45º checkered pattern? Maybe I could edit that code a bit…!

  • http://leaverou.me Lea Verou

    That’s what view source is for :)

    In a nutshell, there’s an optional first argument for the angle.

  • http://www.cricketkafunda.com/2011/04/28/powerful-new-css-techniques-and-tools/ Powerful New CSS Techniques and Tools | CRICKET ka FUNDA

    [...] Checkerboard, striped & other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery</a. [...]

  • http://demoarea.info/test1/?p=23 Powerful New CSS Techniques and Tools | test1

    [...] Checkerboard, striped & other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery ← Showcase of Creative Navigation Menus: Good and Bad Examples Pixel Perfection When Rotating, Pasting And Nudging In Photoshop → [...]

  • http://demoarea.info/test2/?p=36 Powerful New CSS Techniques and Tools | test2

    [...] Checkerboard, striped & other background patterns with CSS3 gradientsYou’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery ← Showcase of Creative Navigation Menus: Good and Bad Examples [...]

  • http://ignacio.com.mx/2011/05/03/various-background-patterns-with-css3-free/ Various Background Patterns With CSS3 – Free | ignacio.com.mx

    [...] Url del codigo Te Gustó este post? solo invitame un [...]

  • http://author1s11.wordpress.com/2011/05/03/creating-patterned-backgrounds-with-css/ Creating patterned backgrounds with CSS | My Blog
  • http://www.ottorask.com/2011/05/css3-gradients-and-text-lines/ Using CSS3 gradients to create text leading lines | Otto Rask

    [...] big thanks to Lea Verou for the idea and inspiration to craft this [...]

  • http://90du.es/2011/06/background-patterns-with-css3-gradients/ CSS3 渐变背景图案 – 网页设计 – css – 九十度

    [...] 原文:leaverou.me [...]

  • http://www.red-team-design.com/cool-notification-messages-with-css3-jquery Cool notification messages with CSS3 & Jquery – Red Team Design

    [...] CSS3 gradients syntax updated. Now, Safari also renders background stripes. [...]

  • http://www.dotauniversalmaphack.com/ Dota Maphack

    These would come in handy for my web3.0 sites, no doubt.

  • http://sejix.com/blog/design/powerful-new-css-techniques-and-tools/ Powerful New CSS Techniques and Tools | Sejix Technologies Blog

    [...] Checkerboard, striped & other background patterns with CSS3 gradients You’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery [...]

  • http://author1sum11.wordpress.com/2011/07/21/checkered-background-pattern-using-only-css/ Checkered Background Pattern Using only CSS « Authoring 1 Summer 2011
  • http://ahmetfatih.sitewebadam.com/2011/08/css-renk-gecisleri-gradients-2/ aHmetfatiH » Blog Archive » CSS Renk Geçişleri (Gradients)
  • http://twitter.com/SummerRJ Summer Johnston

    Great job! Thanks for sharing!

  • http://www.inspiretechs.com/blog/?p=312 Powerful New CSS Techniques and Tools | Inspire Technologies

    [...] Checkerboard, striped & other background patterns with CSS3 gradients You’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery [...]

  • SK

    By just adding the ‘background size’ to the slanted/45deg stripes pattern, a beautiful repeating triangles pattern is created.

    background-color: #0ae;
    -webkit-background-size: 36px 36px;
    background-image: -webkit-repeating-linear-gradient(45deg, transparent,transparent 25px, rgba(255,255,255,.5) 25px, rgba(255,255,255,.5) 50px);

  • SK

    A small variation on the Polka Dots…

    background-color: black;-webkit-background-size: 40px 40px;background-position:0 0, 20px 20px;background-image: -webkit-radial-gradient(closest-side, white 40%, transparent 50%), -webkit-radial-gradient(closest-side, rgba(255, 255, 255, .3) 30%, transparent 30%);

  • SK

    A Pearly Shippo -

    background-color: black;-webkit-background-size: 50px 50px;background-position:0 0, 25px 25px;background-image: -webkit-radial-gradient(closest-side, white 10%, transparent), -webkit-radial-gradient(closest-side, transparent 85%, white 85%, white 95%, transparent), -webkit-radial-gradient(closest-side, transparent 85%, white 85%, white 95%, transparent);

  • SK

    Check out here - http://jsfiddle.net/schugh10/dDngZ/

  • SK

    Here -> http://jsfiddle.net/schugh10/WBFSV/

  • SK

    Here -> http://jsfiddle.net/schugh10/77Z7c/

  • http://leaverou.me Lea Verou

    That’s interesting, but it’s already been done in the patterns gallery: http://leaverou.me/css3patterns/

    (see the Shippo and Brady Bunch patterns)

  • SK

    Smileys :-) ->  http://jsfiddle.net/schugh10/EPXbs/2/

  • http://leaverou.me Lea Verou

    Good idea. You could actually do a proper mouth, with just one radial gradient. Make an outlined circle and move it so that a bit more than half gets cut off at the top. ;)

  • SK

    Couldn’t think of earlier how to do that, but now it is done, still required 2 gradients for the mouth to cut off the un-needed part at the top. Pl check out -> http://jsfiddle.net/schugh10/PMg9u/1/

    Feel free to include in the Patterns Gallery if it is useful.

  • http://leaverou.me Lea Verou

    You don’t need two gradients. Just one that starts with transparent, then goes to red, then transparent again. Also, the center could probably work best at 50% 0%, since a mouth is more commonly depicted as half a circle, not 90% of a circle.

  • SK

    Not sure how to get the mouth with one gradient. Probably you could help with that.  But here is my latest attempt with smaller face and numbers converted to % vals - http://jsfiddle.net/schugh10/PMg9u/2/

  • SK

    Started with something else, ended up with Diamonds :-)  =>  http://jsfiddle.net/schugh10/EVqH2/3/

  • http://www.seekphp.com/is-it-possible-to-create-a-grid-like-background-in-css-without-images-or-tables/ Is it possible to create a grid-like background in CSS without images or tables? | SeekPHP.com

    [...] You can do that in CSS3 possibly, take a look here: http://leaverou.me/2010/12/checkered-stripes-other-background-patterns-with-css3-gradients/ [...]

  • SK

    Elementary but beautiful – Rainbow -> http://jsfiddle.net/schugh10/E7N9r/8/

  • http://leaverou.me Lea Verou

    Here’s how you can get a smiley mouth with only one gradient: http://jsfiddle.net/leaverou/hubBA/

  • http://sevenspark.com/free-stuff/css3-progress-bars CSS3 Progress Bars – SevenSpark

    [...] Lea Verou’s Checkerboard, striped & other background patterns with CSS3 gradients Tweet this → Share on Facebook → This entry was posted in Free Stuff and tagged CSS3, free, progress bar. Bookmark the permalink. [...]

  • Anonymous

    Great techniques :P

  • http://www.teodora.me.uk/blog/wordpress/?p=23 CSS3 Patterns Gallery |

    [...] original post at http://leaverou.me/2010/12/checkered-stripes-other-background-patterns-with-css3-gradients/ or view gallery at http://leaverou.me/css3patterns/ This entry was posted in Uncategorized. [...]

  • http://www.wdesignlove.com/coding/new-css-techniques-and-tools/ New CSS Techniques and Tools | W Design Love | Graphic and Web Design Blog | Coding | tutorials | freebies | Wordpress | inspiration | Blog

    [...] Checkerboard, striped & other background patterns with CSS3 gradients You’re probably familiar with CSS3 gradients by now, including the closer to the standard Mozilla syntax and the verbose Webkit one. I assume you know how to add multiple color stops, make your gradients angled or create radial gradients. What you might not be aware of, is that CSS3 gradients can be used to create many kinds of commonly needed patterns, including checkered patterns, stripes and more. Also, check out Lea’s CSS3 Patterns Gallery [...]

  • http://csspro.digitalskill.jp/%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab/css3/css3%e3%82%b0%e3%83%a9%e3%83%87%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e3%82%b9%e3%83%94%e3%83% CSS3グラデーションのスピードアップを図る! – CSSPRO

    [...] Lea Verou - 巧妙かつ実践的な背景テクニック、グラデーション用構文自動作成コンバータ [...]

  • http://www.montserrat-communication.com/css3pie-styles-css3-pour-internet-explorer/ CSS3Pie, styles CSS3 pour Internet ExplorerMontserrat Agence de Communication | Montserrat Agence de Communication

    [...] vous ne pouvez donc pas utiliser des effets évolués tels que présentés sur cette page : gradient pattern effects (en [...]

  • http://studiogaki.com/archives/1745 CSS3 Tips: ボタン | Studio GAKI !

    [...] Cross-browser CSS gradient button グラデーションボタンを作る方法。 「Checkerboard, striped & other background patterns with CSS3 gradients」のチェックなどの模様を付けるテクニックも使ってグラデーション+模様のボタンを作っています。各ブラウザでの見え方も検証してくれていて親切です。ロールオーバーもするので格好良いです。 DEMO Cross-browser CSS gradient button [...]

  • Infinitevizionz

    It is realy true information, thanks for sharing.

  • http://www.virtualidstudios.com David

    Holy smokes, this is amazing!
    Any chance you could add the vendor prefixes to the patterns?  -moz and -webkit?
    And/or, if I did so, would you post them?

  • http://leaverou.me Lea Verou

    What do you mean? The linked page already has those prefixes. Are you referring to the pattern gallery? If so, it’s trivial for somebody to add them.

  • http://twitter.com/ahhmarr ahmar

    please dIE

  • http://leaverou.me Lea Verou

    There there, IE10 supports gradients just fine :)

  • http://wanico.wamimo.net/blog/blog/2012/%e7%89%88%e9%9d%a2-crochimera-1-0/ 佈景主題:Crochimera 1.0 | Lab Crocodile

    [...] 參考文章: 香腸炒魷魚:WordPress佈景改寫成HTML5的前置步驟 網路集客力:Inbound Marketing Force:HTML5 與 SEO – HTML4/XHTML 與 HTML5 語義架構的差別 LEA VEROU:Checkerboard, striped & other background patterns with CSS3 gradients [...]

  • Carl Papworth

    Can I make the strokes of the stripe-pattern different size with the CSS?