How to make two charts using highchart show up in

2020-04-21 03:23发布

I want to display two charts in the same line using div. Can you please help?

Here is the what I am trying but it shows up in 2 lines.

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
    <div>
        <div id="container" style="width: 200px; height: 200px; diplay:inline"></div>
        <div id="container2" style="width: 200px; height: 200px; display:inline"></div>

    </div>

full code in http://jsfiddle.net/nCe36/

2条回答
够拽才男人
2楼-- · 2020-04-21 04:04

Try:

display: inline-block;

Modified example: http://jsfiddle.net/pzqLG/

查看更多
Animai°情兽
3楼-- · 2020-04-21 04:19

Just float the containers left!

Either give both #container and #container2 a left float:

#container,
#container2 {
    float: left;
}

(Demo)

Or give both containers a class (say, "container") and float that class left:

.container {
    float: left;
}

(Demo)

Edit: display: inline-block will also work, as @Nile has pointed out. It's a matter of personal preference: I tend to prefer floats; some people, inline-blocks. For more information on which to use, you might want to check out this post: float:left; vs display:inline; vs display:inline-block; vs display:table-cell;.

查看更多
登录 后发表回答