I have an SVG that I am trying to center in a div. The div has a width or 900px. The SVG has a width of 400px. The SVG has its margin-left and margin-right set to auto. Doesn't work, it just acts as if the left margin is 0 (default).
Anyone know my error?
Best Answer
SVG is inline by default. Add
display: block
to it and thenmargin: auto
will work as expected.