0

ユーザーが何か間違ったことを入力したときに、アウトラインの色をテキストボックスに入れたいです。問題は、IE8 がoutline属性をサポートしていないことです (少なくとも私は成功せずにテストします) border。代わりに次を使用します。

borderしかし、私はIE8とoutlineそれをサポートするブラウザに使いたい.

.myclass
{
  border: ; // IE8 should use this
  outline: ; // Browser that support it must ignore the above one and get this.
}

IE8 と Chrome でテストしたところ、Chrome では両方の属性が適用され、IE8 では境界線のみが適用されました。

例:

.myclass
{
  border: 1px solid red;
  outline:#00FF00 dotted thick;
}

http://jsfiddle.net/puD97/

ありがとうございました。

4

1 に答える 1

0

outlineIE8 がプロパティをサポートしていないと誰が言いましたか?

それでも、IE と他のブラウザーで異なるスタイルが必要な場合は、IE 固有の cstylesheet コメントを使用して IE 固有のスタイルシートを使用します。

<!-- This will be ignored by all browsers but IE -->

<!--[if IE]>
    <link rel="stylesheet" type="text/css" href="ie-only.css" />
<![endif]-->

または、特定の IE バージョンをターゲットにする

<!--[if IE 8]>
    <link rel="stylesheet" type="text/css" href="ie7.css">
<![endif]-->

またはあなたのページでこれを使用してください

<!--[if IE 8]>
    <style>
      /* Styles goes here */
    </style>
<![endif]-->
于 2012-11-22T13:54:04.247 に答える