0

データベースからいくつかの画像をドラッグし、float:left; を使用して表示する php スクリプトを取得しました。だから彼らは左から右に行きます。

ただし、CSS でコンテナーの幅を定義しない限り、2 行目にジャンプします。

だから質問です!

私の人生では、コンテンツの幅を把握し、JavaScriptを介して幅属性をすべて1回のロードで設定するにはどうすればよいでしょうか。

最初に画像/レイアウトをレンダリングして幅を取得してから調整する必要があるため、これは簡単に可能ではないのではないかと少し心配していました。

アイデアは人々を喜ばせます!! バツ

4

1 に答える 1

0

Your question has to do with how the flows of floats work...

If two images are floated and the sum of their widths is wider than the containing element, they will wrap (similar to the way words in a paragraph wrap).

Visual references describing the flow of "float"ed elements (way too difficult to describe in a few words):

于 2010-10-08T11:41:27.717 に答える