<html> <head> <style> div { background: -webkit-canvas(squares); width:600px; height:600px; border:2px solid black } </style> <script type="application/x-javascript"> function draw(w, h) { var ctx = document.getCSSCanvasContext("2d", "squares", w, h); ctx.fillStyle = "rgb(200,0,0)"; ctx.fillRect (10, 10, 55, 50); ctx.fillStyle = "rgba(0, 0, 200, 0.5)"; ctx.fillRect (30, 30, 55, 50); } </script> </head> <body onload="draw(300, 300)"> <div></div> </body> </html><p>Firefox 구현 <p>Firefox 4에서는 캔버스를 포함한 모든 요소를 허용하는 기능을 도입했습니다. CSS 배경으로 사용:
<p><p>이 기능에 대한 자세한 내용은 Mozilla를 참조하세요. 해킹 웹사이트.
위 내용은 캔버스를 CSS 배경으로 사용할 수 있나요?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!