Live data from Hacker News

Mona Lisa in pure CSS

codepen.io

81–90 of 97 posts

Re: Mona Lisa in pure CSS

#82
post #69
post #23

Earlier quoted context omitted.

At least it's better than X in pure HTML5 .

And that is better than the X in pure javascript posts, with X being something which was impressive 10 years ago in other languages

...doing the same in a more restrictive environment (in this case, browser) is always an accomplishment.

Re: Mona Lisa in pure CSS

#83
post #41
post #22

Earlier quoted context omitted.

You know, I was going to write that it was a given since CSS is applied to a markup language so you need some sort of markup, and that you were being pedantic. But then I thought it would be neat if someone were to make the Mona Lisa as ASCII art using only valid CSS, thus rendering a truly pure CSS version. I guess you could further argue that it isn't pure CSS because it also involves something to display the text.

You don't need HTML at all. Using pseudo elements and taking advantage of browser assumptions you can make HTML-free webpages: http://css-tricks.com/using-css-without-html/

Works for me on Firefox 15 (linux)

Re: Mona Lisa in pure CSS

#84
post #17

Jeez. If your underlying method is pixels, you can render any image you want. I'm afraid I'm missing the "hack" here.

I agree, I was expecting some CSS hackery.

But this is nothing more than using CSS for pixels. With that logic you could theoretically create anything.

Re: Mona Lisa in pure CSS

#85
post #16

About ten years ago I made a converter application that converted a image (jpg/png/gif) to an HTML table. The result at the time was great. Unfortunately the generated HTML was quite verbose so it took a lot of bandwidth to download. I guess a similar conversion program has been used here and it seems that CSS these days can take off quite a bit of fat of that generated code. PS: Forgot to mention. The reason I wrote…

If you want to stop people from right-clicking and saving, why not just cut the image into 16 smaller images? That would also make right-clicking and saving more difficult than screen-printing, so there's no point doing anything more advanced. For even more entertainment value, you could make the pieces irregular shaped, with transparency :-)

Re: Mona Lisa in pure CSS

#90

So... It's a bitmap-image written in CSS boxshadows. It's a bitmap written in text. The resulting CSS is 247KB. Taking the same image and saving as a JPG (which I think is fair, since it's fairly blurry) results in a 40KB file. That's more than 6 times smaller. If you scale it down to the detail level found the CSS (each CSS-"pixel" being a 4x5 unit) even a PNG will easily beat it at 24KB. Here the JPG also clocks in…

I was going to say this sort of thing would be useful on reddit for subreddit stylesheets, but they allow uploading images. So there's no practical application at all.
Post reply on HN