2011-06-29 9 views
0

nav divは垂直に固定し、コンテナdivの右側に座らなければなりません。divを垂直方向に修正し、別のdivに右揃え

position:fixed;を使用し、左と上の値を設定すると、divは同じ場所にとどまりますが、親のdiv(ページコンテナ)が中央に配置されるため、左の値が異なります。

<html> 
<body> 
<div id="page-container" style="width: 700px; height:1000px; margin-left: auto; margin-right: auto;background-color:moccasin;"> 

    <div class="content" style=" width: 340px; height:300px; float:left;background-color:mediumseagreen;"> 
     .content 
    </div> 

    <div class="nav" style="float:left;height: auto; width: 300px; display: block;background-color:lightblue;"> 
     .nav <br><br>This div must:<br> 
    1. be fixed vertically (if scrolling down, you should see me in the same place) <br> 
    2. be aligned to the right side of <b>content</b> 
    </div> 
</div> 
</body> 
</html> 

enter image description here

答えて

関連する問題