Javascript 我的代码有什么问题?java脚本图表位置

Javascript 我的代码有什么问题?java脚本图表位置,javascript,css,html5-canvas,chart.js,Javascript,Css,Html5 Canvas,Chart.js,我正在尝试将我的两个Chart.js设置为水平位置。但不幸的是,我的两张图表部门对这种风格没有反应。有人知道我的代码有什么问题吗 <style> #Bar { position: absolute; left: 0px; right: 0px; bottom: 0px; top: 0px; } #Pie { position: absolute;

我正在尝试将我的两个Chart.js设置为水平位置。但不幸的是,我的两张图表部门对这种风格没有反应。有人知道我的代码有什么问题吗

   <style>
    #Bar {
        position: absolute;
        left: 0px;
        right: 0px;
        bottom: 0px;
        top: 0px;
    }

   #Pie {
        position: absolute;
        left: 500px;
        right: 0px;
        bottom: 0px;
        top: 0px;
    }
</style>



<div class="Bar">

    <label for="myChart">
        Bar chart Title <br />
        <canvas id="myChart" width="300" height="250"></canvas>
    </label>
</div>


<div class="Pie">
    <label for="myPieChart">
        Pie chart Title<br />
        <canvas id="myPieChart" width="250" height="250"></canvas>
    </label>
</div>

#酒吧{
位置:绝对位置;
左:0px;
右:0px;
底部:0px;
顶部:0px;
}
#馅饼{
位置:绝对位置;
左:500px;
右:0px;
底部:0px;
顶部:0px;
}
条形图标题
饼图标题

您使用css
id(#)
选择器,但是您的div上有
类(.)
es。将
class
es更改为ids

<div id="Bar">

    <label for="myChart">
        Bar chart Title <br />
        <canvas id="myChart" width="300" height="250"></canvas>
    </label>
</div>


<div id="Pie">
    <label for="myPieChart">
        Pie chart Title<br />
        <canvas id="myPieChart" width="250" height="250"></canvas>
    </label>
</div>
示例

#条{
位置:绝对位置;
左:0px;
右:0px;
底部:0px;
顶部:0px;
}
#馅饼{
位置:绝对位置;
左:500px;
右:0px;
底部:0px;
顶部:0px;
}

条形图标题
饼图标题
您使用css
id(#)
选择器,但是您的div上有
类(.)
es。将
class
es更改为ids

<div id="Bar">

    <label for="myChart">
        Bar chart Title <br />
        <canvas id="myChart" width="300" height="250"></canvas>
    </label>
</div>


<div id="Pie">
    <label for="myPieChart">
        Pie chart Title<br />
        <canvas id="myPieChart" width="250" height="250"></canvas>
    </label>
</div>
示例

#条{
位置:绝对位置;
左:0px;
右:0px;
底部:0px;
顶部:0px;
}
#馅饼{
位置:绝对位置;
左:500px;
右:0px;
底部:0px;
顶部:0px;
}

条形图标题
饼图标题