Placed in: Home arrow Programming arrow Webdesign arrow Generating the pixellogo from TechCrunch in HTML comprar viagra en espaƱa
comprar viagra online
comprar viagra generico barato
comprar cialis generico online
comprar cialis online seguro
Generating the pixellogo from TechCrunch in HTML

A while ago, the popular tech blog TechCrunch launched a new design for their website. Along with this design, they released a new logo. I wanted to generate this logo in HTML using jQuery.

HTML TechCrunch Pixellogo

This logo looked like the perfect candidate to do so, since it uses huge pixels and only a couple of colours (4 shades of green). With only little HTML, CSS and jQuery, I was able to generate this logo with not much effort.

Demo HTML TechCrunch Pixellogo   Download HTML TechCrunch Pixellogo

Did you check out the demo to see what we're going to do? This is how you can generate this pixellogo yourself!


As always, the HTML is kept really clean. For this demo, we only need one container that will hold all the "pixels" from the logo.

<div id="techcrunch">
    <!-- jQuery will inject the HTML here -->

Take note of the id which is used, since we refer to that in the CSS and the jQuery.


On to something more interesting, the CSS. As you can see, each pixel has a fixed width and height which will fill the pixellogo.

#techcrunch {
    width:240px; height:120px; margin:0 auto; }
.pixel { width:10px; height:10px; float:left; }
.shade1 { background-color:#24e100; }
.shade2 { background-color:#1cbe01; }
.shade3 { background-color:#159700; }
.shade4 { background-color:#0a6300; }

The different shades are numbered. This is essential for the technique we use with the jQuery. The .shade1 is the lightest shade of green, the .shade4 the darkest.


Now to generate the pixellogo! The code isn't that hard to understand (I added some comments as well), so just look at it first.

// Two dimensional array that represents the logo
// Each number represents a different shade, which is referred to in the CSS
var techcrunchLogo =
// Generate the logo by iterating over the techcrunchLogo arrays
for(var i = 0; i < techcrunchLogo.length; i++) { // Rows
    for (var j = 0; j < techcrunchLogo[i].length; j++) { // Columns
        $("<div />")
            .addClass("shade" + techcrunchLogo[i][j])

As you might have seen, the most important part is the techcrunchLogo variable. Each number represents a different shade, which is referred to in the CSS. We than iterate over the arrays to "paint the pixels" from the logo, and add them to the container.

That's all there is to it! We now generated the TechCrunch logo in HTML using some nifty jQuery and CSS.

Conclusion & Download

I hope you understand this was just a little fun project; In theory, you could even make the CSS .pixel class have a width and height of 1px and generate anything you like. Still, this looked like the perfect example for me since the pixels were big and not a lot of colours are used.

Demo HTML TechCrunch Pixellogo   Download HTML TechCrunch Pixellogo

What do you think of this technique? Would you like to improve the code? Would you rather see something different? Feel free to share!

Tags:  pixellogo generate techcrunch html jquery

Interested in this topic? You might enjoy another article I've written called

Did you like this article? Subscribe to my feed or email to keep updated on new articles.

Spread the word and submit to:
< Prev   Next >

Subscribe to Marcofolio