我有一个并排设置,使用 div 容器(2 个容器在一个容器中),并且我无法让右侧与我的浮动右侧对齐到顶部

发布于 2025-01-17 04:57:57 字数 690 浏览 1 评论 0原文

我已经弄清楚如何让我的两个部分并排出现在我的 div 容器中。左侧是幻灯片和幻灯片。正是我希望它出现的位置/方式,但右侧不会与顶部对齐。

我添加了额外的措辞,看看这是否会将其全部“推”到顶部,但它一直在下降。我尝试将vertical-align top添加到.alignright,以及我在这里找到的所有其他对齐解决方案。在其他网站上。

向右浮动的alignright必须保留,否则所有文字都会向左移动,在幻灯片旁边向右移动(看起来很糟糕)。 我已附上当前输出。 “在过去”我会 valign=top &然后,但这没有效果。

<div class = "text">
<p class ="alignright">

Save a Life
<br>
images go here
<br>
Donate Now
<br>
TEXT

</p>
</div>



.alignright {
    float: right;
.text {
  color: #0000A0;
  font-family: Georgia,Times,Times New Roman,serif; 
  font-size: 80px;
  font-weight: bold;
}

当前输出

I have figured out how to get my 2 sections to appear side-by-side within my div container. The left side is a slideshow & is exactly where/how I want it to appear, but the right side won't align to the top.

I have added extra verbiage to see if that would "push" it all to the top, but it kept going lower. I've tried adding vertical-align top to .alignright, along with all the other solutions for alignment I have found here & on other sites.

The alignright being a float to the right has to stay or the verbiage all shifts left, right up next to the slideshow (and looks horrible).
I've attached the current output. "In the olden days" I would valign=top & then , but that has no effect.

<div class = "text">
<p class ="alignright">

Save a Life
<br>
images go here
<br>
Donate Now
<br>
TEXT

</p>
</div>



.alignright {
    float: right;
.text {
  color: #0000A0;
  font-family: Georgia,Times,Times New Roman,serif; 
  font-size: 80px;
  font-weight: bold;
}

current output

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

私野 2025-01-24 04:57:57
#container{
display:flex;
justify-content:space-between;
align-items:center;
}

#left, #right{
border:solid 1px green;


}

#left {

margin-left:150px;
}
<div id='container'>
<div id = 'left'>x<br>x<br>x</div>
<div id = 'right'>x</div>
</div>

#container{
display:flex;
justify-content:space-between;
align-items:center;
}

#left, #right{
border:solid 1px green;


}

#left {

margin-left:150px;
}
<div id='container'>
<div id = 'left'>x<br>x<br>x</div>
<div id = 'right'>x</div>
</div>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文