Skip to content

Comment on Ha Do That in HTML5

Comments

From stackoverflow.com where some misguided fool wants to draw his page background with canvas:

… Webkit-based browsers do allow you to use a element in the CSS background property. Just give the canvas an id, then use "body { background:url(#mycanvas); }" in your CSS.

Sure, that isn't in the HTML5 standard per se, but since there is no HTML5 standard we can pretend it is.

steveklabnik points out in this thread an example of someone doing it, http://mobdb.com/reddit/button.html , but they use absolute positioning to overlay the button and canvas and will surely go mad if they try to use it for real.

I suppose, with this newfound CSS knowledge I will now have to change my home page background to a hilbert curve.

Edit: Actually, I think I'll use the "background: -webkit-canvas(name)" and getCSSCanvasContext() DOM function documented at http://webkit.org/blog/176/css-canvas-drawing/

Upshot: No hilbert for me. Takes about 1 second to render a maximally detailed hilbert in my browser on a core i7 processor.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.