LoginSignup
1
2

More than 5 years have passed since last update.

Firefoxで、float:right が落ちる

Last updated at Posted at 2016-04-27

実装例

firefox

スクリーンショット 2016-04-27 10.52.47.png
"with nowrap"の方で、"test"という文字が次の行に行ってしまっている。

chrome

スクリーンショット 2016-04-27 10.52.41.png
"with nowrap"の方でも、その左端に"test"という文字列がある。

状況

上記 fiddle をみてもらうのが一番わかり易いが…

  • [HTML] どちらも、divタグの中に、テキスト("with nowrap" or "flow")が入っているだけ
  • [CSS] そのdivに、cssの ":after" で、"test"という文字列を記載している
  • [CSS] この要素には、 float:right; が付加されている。
  • [CSS] "with nowrap"側と"flow"側との違いは、 大外のdivに"white-space: nowrap;"がついてるかどうか だけ。

所感

  • どうも、nowrapをつけると、インライン要素(with nowrapの部分)もしくは floatされた要素が、display: block; に近い挙動になるっぽい。
  • これはFirefoxのバグなのか、それとも他のブラウザがイレギュラー実装なのか…
1
2
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
2