2017-02-24 39 views
1

我已經創建了以下HTML/CSS以使圖表填充65%的空間,爲300px表留出空間。我希望圖表始終填充所有剩餘的空間,無論剩下多少或多少。如何確定圖表的大小以始終填充空間

https://jsfiddle.net/horacebury/2vc606wx/17/

HTML:

<div ng-app="App"> 
    <div ng-controller="TodoCtrl"> 
    <div id="tablecontainer"> 
     <table class="tgh"> 
     <tr> 
      <td>Auxilliary Power</td> 
     </tr> 
     </table> 
     <div id="example"></div> 
     <table class="tg"> 
     <tr> 
      <td class="tg-yw4l" ng-repeat="item in items track by $index">{{item}}</td> 
     </tr> 
     </table> 
    </div> 
    <div id="c3chart"></div> 
    </div> 
</div> 

CSS:

#tablecontainer { 
    float: right; 
} 

#c3chart { 
    width: 65%; 
} 
+0

你最好的選擇是使用[flex-box](https://css-tricks.com/snippets/css/a-guide-to-flexbox/),只要你不需要提前支持IE版本。 – user3432422

+2

看看溢出:隱藏答案在這裏 - > http://stackoverflow.com/questions/1260122/expand-a-div-to-take-the-remaining-width結果:https://jsfiddle.net/2vc606wx/28 / – mgraham

回答

相關問題