【问题标题】:Having charts in center align - d3使图表居中对齐 - d3
【发布时间】:2018-05-12 13:21:05
【问题描述】:

我有三个图表,我希望它们都位于 HTML 页面的中心。我知道以前有人问过这个问题,但没有一个解决方案对我有用:

我尝试了 thisthis 引用。

您能否就此Plunker 给我一个反馈,以便在页面中心放置图表?

svg{
    display: block;
    margin: auto;
  }

【问题讨论】:

    标签: javascript html css d3.js svg


    【解决方案1】:

    将您的 SVG 包装在父 div

    <div class="svg-container">
       <!-- ...svgs -->
    </div>
    

    然后在你的CSS

     .svg-container{
         display: inline-block;
         margin: 0 auto;
      }
    

    您可能还需要调整 div 的宽度

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-09
      • 2012-07-02
      • 1970-01-01
      • 2014-10-13
      • 2014-03-06
      • 2012-01-30
      • 2017-03-28
      相关资源
      最近更新 更多