28 lines
593 B
HTML
28 lines
593 B
HTML
<html>
|
|
<head>
|
|
<style>
|
|
div {
|
|
background: -webkit-canvas(squares);
|
|
width: 200px; height: 200px;
|
|
border: 2px solid black;
|
|
margin: 10px;
|
|
}
|
|
</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(150, 150)">
|
|
<div></div>
|
|
<div style="zoom: 1.5"></div>
|
|
</body>
|
|
</html> |