LoginSignup
16
14

More than 5 years have passed since last update.

HTML で aタグを使ってるのに、矢印カーソルが出てこなくてなんでやねんと思った時

Posted at

こんな感じに書いちゃうと・・

<a class="hogehoge">ここはリンクなの!</a>

何故かマウスオーバーしてもカーソルがポインタにならない。

正しくは

<a href="#" class="hogehoge">ここはリンクなの!</a>

href属性がないと、aタグでもポインタにならん。
JavaScript使ってページ制御してたりすると、地味にハマった・・

.clickable {
  cursor: pointer;
}

とか定義して、classに付けてやるか、ちゃんとhref属性書けるなら書く。

Bootstrap使ってて、なんでaタグ置いたのにカーソルポインタにならんのだ~
とBootstrapの他の定義を疑っていたが、全然関係なかった・・・
(どっかでcursor : default;やられてると思って一生懸命さがしてましたとさ;;)


参考リンク An alternative to cursor:pointer is adding an inert href attribute for the <a

16
14
1

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
16
14