简体   繁体   中英

Html divs not aligning vertically

I'm trying to vertically align two Google Charts, one Bar Chart and one PieChart -> http://plnkr.co/edit/OtXFlav09r4WvoYC16X0?p=preview

Inside the body I have:

<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>

but the two charts do not get aligned. Why?

UPDATED CODE

<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>

Insert in pieOptions

chartArea: {left:0,top:0}

and change values like you want

Plnkr

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM