+ 1

Rectangle

How do I make a rectangle

7th Dec 2017, 4:52 PM
Benjamin Ashrafi
Benjamin Ashrafi - avatar
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>
7th Dec 2017, 5:05 PM
Ranjan Bagri
Ranjan Bagri - avatar
+ 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>
7th Dec 2017, 6:56 PM
Ranjan Bagri
Ranjan Bagri - avatar
0
Sorry I mean for javascript
7th Dec 2017, 5:18 PM
Benjamin Ashrafi
Benjamin Ashrafi - avatar
0
Red rectangle using canvas in js https://code.sololearn.com/WrJ0Kl1EffkD/?ref=app
8th Dec 2017, 6:32 AM
#RahulVerma
#RahulVerma - avatar