How to add a border around a canvas?
12,695
Solution 1
outline: black 3px solid;
Outline will draw a line outside the element.
Solution 2
may i suggest this:
<canvas id="canvas"></canvas>
#canvas{
border:2px solid black !important;}
![Thomas](https://i.stack.imgur.com/aHEyF.jpg?s=256&g=1)
Author by
Thomas
just an student wich is making some fun on making batch files
Updated on June 04, 2022Comments
-
Thomas about 2 years
I want to now how you can add a border around a canvas. So simply with the CSS code
border:black 3px solid;
you get the border in the canvas. And I dont want the border in the canvas. I want the border around the canvas. I want this with CSS.
Thanks for helping!
my css code:
#my_canvas { max-width: 98%; max-height: 98%; height: auto; width: auto; margin:auto; position: absolute; top: 0; bottom: 0; left: 0; right: 0; background-color:white; border:black 3px solid; } #center { max-width: 66.5%; max-height: 95%; height: auto; width: auto; margin:auto; background:; position: absolute; top: 0; bottom: 0; left: 0; right: 0; } Body { background-color: slategrey; }