1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cssでインジケータ

Last updated at Posted at 2025-07-05

はじめに

Webシステムの構築で使うインジケータ画像が荒かったので、cssで作り直そうと思います。

サンプル

とりあえず、作ってみました。

See the Pen Untitled by masayasu_t (@cjlsrdxi-the-builder) on CodePen.

こだわりポイント

デザインを作るときにspan要素を多用しがちですが、htmlをシンプルにしたかったのでspan要素なしで作りました。

よくある形式
<div class="loading"><span></span><span></span><span></span></div>
今回の形式
<div class="loading"></div>

疑似要素(before、after)を使っても、2要素…インジケータの複数要素をどう表現するか:thinking:

そこで、「box-shadow」を使いました。

おわりに

「box-shadow」は形を変えられないなど制約はありますが使い勝手はよく、調子に乗ってインジケータをたくさん作ってしまいました。

追記

box-shadowでマリオを作ってみました。

See the Pen Untitled by masayasu_t (@cjlsrdxi-the-builder) on CodePen.

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?