2012-02-10 9 views
2

私はある点(position: absolute; top: ...; left: ...)に置かれたHTML divを持っています。そのポイントからページの端までdivを作成し、ウィンドウのサイズが変更されるとどのようにスケールするのですか?私。 - width: 100%と同じ動作ですが、divの左上隅は特定の任意の点にあります。divの特定のポイントからウィンドウの端までの範囲のCSS

答えて

2

を動作するはずです、あなたはそれが上、左、下、右のプロパティです割り当てることができます。

<html> 
    <head> 
     <style> 
      #foo{ 
       position: absolute; 
       top: 10px; 
       left: 10px; 
       bottom: 0; 
       right: 0; 
       background-color: red; 
       border: 5px solid blue; 
      } 
     </style> 
    </head> 
    <body> 
     <div id="foo"></div> 
    </body> 
    </html> 
2

要素が絶対的に配置されている場合、私が正しく質問を理解している場合、これは

div { 
    position: absolute; 
    left: 100px; << "left top corner of the div at a specific, arbitrary point." 
    top: 0; 
    bottom: 0; 
    right: 0; 
    background-color: #666; 
} 
関連する問題