[英]How to set div position relative to another div only at printing
[英]jQuery how to set the position of a div with relative to another div?
添加CSS規則:
#chart2Buttons {
display: inline-block;
float: right;
}
試試這個CSS:
#chart-2{
position:relative;
}
#chart2Buttons{
position:absolute:
bottom:1px;
right:1px;
}
將包裝器div添加到圖表和按鈕,並將顯示設置為內聯塊和包裝器的相對位置。 絕對定位按鈕並將其放在下角,如下所示
.graph{ width: 400px; height: 400px; background: crimson; line-height: 400px; text-align: center; color: white; font-size: 20px; } .wrapper{ position:relative; display: inline-block; } #chart2Buttons{ position: absolute; width: 40px; height: 40px; right: 0; bottom: 0; background: cornflowerblue; color: white; line-height: 40px; text-align: center; }
<div class="wrapper"> <div id="chart-2" class="graph"> GRAPH </div> <div id="chart2Buttons">B</div> </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.