gpt4 book ai didi

css - 如何水平对齐多个图像(连续)?

转载 作者:行者123 更新时间:2023-12-03 23:31:54 28 4
gpt4 key购买 nike

如何水平对齐多张图像,一张一张地?它们不必适合宽度屏幕:相反,我希望它们超过后者的宽度,如果这有任何意义的话。

我已经检查了很多类似问题的答案,但找不到任何可以解决我的问题的答案。

HTML:

<div id="content">
<img src="Content/Images/Personal/Georges.jpg" alt="Georges" class="images" />
<img src="Content/Images/Personal/Rose.jpg" alt="Gers" class="images" />
<img src="Content/Images/Personal/Henry.jpg" alt="Providence" class="images" />
</div>

CSS:

.images
{
display: inline;
margin: 0px;
padding: 0px;
}

#content
{
display: block;
margin: 0px;
padding: 0px;
position: relative;
top: 90px;
height: auto;
max-width: auto;
overflow-y: hidden;
overflow-x:auto;
}

提前谢谢你。

最佳答案

实际上,您希望防止 inline img 元素包装,因此,您希望在父 #content 上使用以下内容> 元素:

white-space:nowrap;

Demo Fiddle

More on white-space from MDN

nowrap Collapses whitespace as for normal, but suppresses line breaks (wrapping).

此样式专门用于您需要的目的。

关于css - 如何水平对齐多个图像(连续)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25202348/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com