+ 1
Rectangle
How do I make a rectangle
4 Respuestas
+ 11
<!DOCTYPE html>
<html>
<head>
<title>Rectangle</title>
</head>
<style>
div{
height:150px;
width:150px;
background:#333;
}
</style>
<body>
<div></div>
</body>
</html>
+ 8
<!DOCTYPE html>
<html>
<head>
<title>Rectangle</title>
</head>
<body>
<script>
window.onload = function(){
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.style.width='100%';
canvas.style.height='100%';
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
canvas.style.position='absolute';
canvas.style.left=0;
canvas.style.top=0;
canvas.style.pointerEvents='none';
var context = canvas.getContext('2d');
context.rect(100, 100, 150, 150);
context.fillStyle = '#333';
context.fill();
}
</script>
</body>
</html>
0
Sorry I mean for javascript
0
Red rectangle using canvas in js
https://code.sololearn.com/WrJ0Kl1EffkD/?ref=app