gpt4 book ai didi

css如何将一个div对齐到包含div的顶部

转载 作者:行者123 更新时间:2023-11-28 14:11:44 24 4
gpt4 key购买 nike

抱歉,基本问题。我有以下布局:

#existing-files .image-row{
width: 700px;
border: 1px solid orange;
padding-left: 10px;
}

.img-row-description{
border: 1px solid black;
display: inline;
width: 400px;
}

它看起来像这样:

enter image description here

我希望 .img-row-description 与包含图像行的顶部对齐。我该怎么做?

最佳答案

我不知道 timpone 的标记是什么样的,但我为任何想探索如何做到这一点的人提供了几个 jsFiddles。

只要标记中的结构简单有效,就可以通过向左浮动 img 而不是使用 vertical-align: top

来实现此效果

取决于你想做什么:

Text wrapping around the image

No text wrapping around the image

关于css如何将一个div对齐到包含div的顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9402319/

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