0

ページの右下に div の位置を固定したい..(チャット ボックス) ..すべての IE6/7/8 および mozilla で動作する css ファイルを介してそれを行う方法..今私が持っています

#chatBox{ 位置: 固定; 下: 0%; 右: 1%;} これは IE では機能しません..そして、私の制約は、この CSS ファイルを編集することだけが許可されていることです (したがって、html を厳密モードに設定することもできません)。私がウェブで見つけた回避策は、ページの下部ではなく上部への位置について話しているだけです。

ありがとうモハン

4

1 に答える 1

1

CSS式でIEを修正できます。条件付きコメントを使用して IE に以下を提供します。

/* smooths out the IE expression scroll - foo doesn't need to exist */
body{
   background:url(foo) fixed;
}

/* fixed scrolling element */
#bottom-fixed-element {
   position: absolute;  
   right: 0;
   top: expression(
      document.body.scrollTop + document.body.clientHeight - this.clientHeight
   );
}

ソースを変更して条件付きコメントを含めることができない場合は、CSS ハックで回避できますが、推奨されません。

#bottom-fixed-element {
   position: fixed;
   bottom: 0;
   right: 0;

   _position: absolute;  
   _top: expression(
      document.body.scrollTop + document.body.clientHeight - this.clientHeight
   );
}

編集

quirks と標準モードの両方をサポートする必要がある場合は、次の式でテストできます。

top: expression(
   (document.compatMode && document.compatMode == 'CSS1Compat') ?          
       (documentElement.scrollTop + documentElement.clientHeight - this.clientHeight) :
       (document.body.scrollTop + document.body.clientHeight - this.clientHeight)
);
于 2010-09-14T19:36:55.863 に答える