我正在尝试使用 div 设置三个部分,中间一个主要部分,左右一个较小的列。我能够做到这一点,但不能让正确的列有一个固定的位置。每当我为此部分添加“位置:固定”时,它都会忽略“浮动:右”并将该部分放在左列的顶部。请注意,我需要在代码中对 div 的左右中间进行排序,否则右列位于其他内容下方的右侧。谢谢。
<div style = "height: 100%">
<div style = "width: 15%; float:left; background-image: url(image.jpg);
background-size: 100% 100%;height: 100%; background-repeat:no-
repeat; background-position:left top; position: fixed" >
<div style = "margin-left:20px; margin-right:20px; margin-top:40px; margin-
bottom:40px">
<p2>
content
</p2>
</div>
</div>
<div style = "width: 15%; float:right; background-image: url(image.jpg);
background-size: 100% 100%; min-height: 100%; background-repeat:no-
repeat; **position: fixed;** background-position:right top">
<div style = "margin-left:20px; margin-right:20px; margin-top:40px; margin-
bottom:40px">
<p2>
content
</p2>
</div>
</div>
<div style = "width: 60%; margin-left:300px; margin-right:300px; top: 100px" >
<h1>head </h1>
<p>content
</p>
</div>
</div>