Html div没有垂直对齐

时间:2015-11-02 15:26:09

标签: javascript html layout charts google-visualization

我正在尝试垂直对齐两个Google图表,一个条形图和一个PieChart - > http://plnkr.co/edit/OtXFlav09r4WvoYC16X0?p=preview

我身体内有:

<body>
<div style="margin-left: 5px; width: 100%;">
  <d2 style="float: left;">
    <big>Oil Consumption - Barrels (from 1965)</big>
  </d2>
  <br />
  <br />
  <d2 style="float: left;">BP Statistical Review of World Energy, June 2015</d2>
  <br />
  <br />
</div>
<div style="width: 100%; overflow: hidden; margin-left: 5px; margin-top: 20px;">
  <div id="div"></div>
  <div id="div1" "float:="" left;"=""></div>
</div>

但两张图表没有对齐。为什么呢?

  

更新代码

<body>
<div style="margin-left: 5px; width: 100%;">
     <d1 style="float: left;"><big>Oil Consumption - Barrels (from 1965)</big></d1> <br><br>
     <d1 style="float: left;">BP Statistical Review of World Energy, June 2015</d1> <br><br>

</div>

   <div style="width: 100%; overflow: hidden; margin-left: 5px; margin-top: 20px;">
     <div id="div"></div>
     <div id="div1" style="float: left;"></div>
   </div>
</body>

1 个答案:

答案 0 :(得分:1)

插入pieOptions

chartArea: {left:0,top:0}

并根据需要更改值

Plnkr