2

I am working on a plot that is using the code from the example here:

http://bl.ocks.org/mbostock/3887118

I am new to HTML, CSS, and JS, but know some of the basics. I was wondering how I can center the plot in the browser's window, specifically what to put into the example code provided. Thanks for the help!

rfoley
  • 345
  • 3
  • 15

2 Answers2

4

You can set margins left and right to auto, but you also need to make the element display as block-level.

svg {
    display: block;
    margin: 0 auto;
}
Josh KG
  • 5,050
  • 3
  • 20
  • 24
0
.plot
{
    margin: 0 auto;
}

that will center it relatively in most browsers.

Chris Peterson
  • 713
  • 7
  • 13