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?

More than 1 year has passed since last update.

【Tailwind CSS】basis-1/2が反映されない場合の対処方法

Last updated at Posted at 2022-05-15

はじめに

プログラミング学習中の@kat_logと申します。

Tailwind CSSにて、basis-1/2等、flexが反映されない問題に直面したのですが、解決したため共有です。

image.png

結論

それぞれの子要素をdivで囲むと解決しました。

具体的なコード

変更前

<div class="flex justify-center">
    <%= image_tag "man.png", class: "basis-1/2" %>
    <%= image_tag "woman.png", class: "basis-1/2" %>
</div>

Screen Shot 2022-05-15 at 19.00.10.png

basis-1/2が反映されず、画像が途切れています…

変更後

<div class="flex justify-center">
  <div>
    <%= image_tag "man.png", class: "basis-1/2" %>
  </div>
  <div>
    <%= image_tag "woman.png", class: "basis-1/2" %>
  </div>
</div>

Screen Shot 2022-05-15 at 19.02.12.png

basis-1/2が反映され、きれいに表示されるようになりました!

おわりに

お読みいただきありがとうございました!
どなたかの参考になれば嬉しいです。

素材

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?