0

I'm having slight issues centering my div. I'm currently using Chart.js inside of a canvas.

Here is the CSS:

#canvas-container {
    text-align: center;
}

canvas {
   display: inline-block;
}

and the HTML

<div id="canvas-container" style="align-content: center">
    <canvas id="myChart" width="500" height="500"></canvas>
</div>

it's just floating to the left

Temani Afif
  • 245,468
  • 26
  • 309
  • 415
  • Did you try using margin:0 auto; on canvas and setting the width of #canvas-container. –  Dec 23 '17 at 13:32
  • 1
    canvas is centered, tested and it's working. Maybe you have more CSS/HTML – Temani Afif Dec 23 '17 at 13:33
  • Possible duplicate of [How to horizontally center a
    in another
    ?](https://stackoverflow.com/questions/114543/how-to-horizontally-center-a-div-in-another-div)
    – Temani Afif Dec 23 '17 at 13:34

0 Answers0