LoginSignup
9
3

More than 5 years have passed since last update.

「pointer-events: none;」がIEで効かない時

Posted at

aタグに「pointer-events: none;」を指定してリンクを無効化しようとしましたが、IEではCSSが効かず普通に押下できてしまいました。

原因

IE11とEdgeでは、aタグのdisplayの値がinline-blockかblock以外だと「pointer-events: none;」が効きません。
(バグ?)

対策その1:「display: inline-block;」を指定する

a.disabled
{
    display: inline-block;
    pointer-events: none;
}

ただし、あくまで「pointer-events: none;」が発火しないだけなので、タブ等でカーソルを合わせるとクリックできてしまいます。
本気でリンクをオフにしたい場合は、aタグ以外で表現するか、aタグを使うならばサーバ側での制御が必須です。

対策その2:IEを使わない

推奨

9
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
3