强制图像彼此相邻

时间:2022-04-15 12:08:53

I have 4 images that I want next to each other no matter what. But when the windows is not wide enough the overflowing images are in the next line. How can I prevent that? I tried "inline", "inline-block" and even "inline-table" but it happens everytime. The images width aren't fixed, they depend on the height of the window, so setting a min-width is not possible. And I don't want to put them together to a single image.

无论如何,我有4个我想要彼此相邻的图像。但是当窗户不够宽时,溢出的图像就在下一行。我怎么能防止这种情况?我试过“内联”,“内联块”甚至“内联表”,但它每次都会发生。图像宽度不固定,它们取决于窗口的高度,因此无法设置最小宽度。而且我不想把它们放在一起形成一张图像。

Thank you for your help Julian

谢谢你的帮助Julian

1 个解决方案

#1


1  

Wrap them in a div and give the div a min-width of the sum of the images' widths.

将它们包裹在div中,并为div提供图像宽度总和的最小宽度。

#1


1  

Wrap them in a div and give the div a min-width of the sum of the images' widths.

将它们包裹在div中,并为div提供图像宽度总和的最小宽度。