28 lines
560 B
HTML
28 lines
560 B
HTML
<html>
|
|
<head>
|
|
<style>
|
|
div {
|
|
width:600px;
|
|
height:500px;
|
|
border:2px solid black;
|
|
content: -webkit-canvas(squares);
|
|
}
|
|
</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, 100, 100);
|
|
|
|
ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
|
|
ctx.fillRect (50, 50, 100, 100);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="draw(300, 300)">
|
|
<div></div>
|
|
</body>
|
|
</html> |