Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a border around a canvas?

Tags:

css

border

canvas

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;
}
like image 454
Thomas Avatar asked Oct 21 '25 13:10

Thomas


2 Answers

outline: black 3px solid;

Outline will draw a line outside the element.

like image 159
Michelangelo Avatar answered Oct 23 '25 03:10

Michelangelo


may i suggest this:

<canvas id="canvas"></canvas>
  #canvas{
border:2px solid black !important;}
like image 45
stranger4js Avatar answered Oct 23 '25 03:10

stranger4js



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!