对齐固定 div 标记百分比
Align fixed div tag percentage
我有两个 <div>
标签(一个是固定的,另一个是相对的,而且都是浮动的)。
我想按百分比并排对齐它们
示例如下
<style>
#mainDiv{
width:80%;
margin-left: 10%;
height: 200px;
}
#fixedDiv{
float: left;
width: 30%;
background-color:red;
position: fixed;
height: inherit;
}
#relativeDiv{
float: right;
width: 70%;
background-color:blue;
position: relative;
height: inherit;
}
</style>
<div id="mainDiv">
<div id="fixedDiv">Fixed DIV</div>
<div id="relativeDiv">Relative DIV</div>
</div>
只需将 #relativeDiv
中的 width
尺寸减小到 width:62%;
或调整它
我有两个 <div>
标签(一个是固定的,另一个是相对的,而且都是浮动的)。
我想按百分比并排对齐它们
示例如下
<style>
#mainDiv{
width:80%;
margin-left: 10%;
height: 200px;
}
#fixedDiv{
float: left;
width: 30%;
background-color:red;
position: fixed;
height: inherit;
}
#relativeDiv{
float: right;
width: 70%;
background-color:blue;
position: relative;
height: inherit;
}
</style>
<div id="mainDiv">
<div id="fixedDiv">Fixed DIV</div>
<div id="relativeDiv">Relative DIV</div>
</div>
只需将 #relativeDiv
中的 width
尺寸减小到 width:62%;
或调整它