0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

aタグをdivで囲むのをやめた

Posted at

aタグを何で囲むべきか

aタグはinline要素なので今まで divで囲っていました
初めてhtmlを学んだ時にdivタグで囲んでいたので、今まではdivを使っていました

divをやめてどうするの?

pタグを使う
pタグで囲む人は一定数いるようです。

なぜ?

webアプリケーションを作成中にdivばかりでコードが読みづらかった

下の例を見てほしい

みずらい!!
<div class="inner">
  <div class="main__link"><a href=""></a></div>
  <div class="main__picture"><img src="" alt=""></div>
</div>
いくらか見やすい
<div class="inner">
  <p class="main__link"><a href=""></a></p>
  <p class="main__picture"><img src="" alt=""></p>
</div>

参考

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?