gpt4 book ai didi

CSS 定位——元素在右下角、左手 Angular

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

我想将“Game on Sep 27”放在左下角,“Lost 100 chips”对面。但我看不到将它定位在左下角。

alt text

这是我当前的 CSS:

alt text

有什么建议吗?非常感谢!

最佳答案

最简单的方法是将所有三个 div(.recentEventsDetail、.recentEventsLowerLeftElement、.recentEventsLowerRightElement)放在 position: relative; 的包装 div 中。然后你可以制作较低的 div position: absolute; 并以这种方式设置位置。例如:

<style type="text/css">
.reventEventsWrapper {position: relative;}
.recentEventsLowerLeftElement {position: absolute; bottom: 0px; left: 0px;}
.recentEventsLowerRightElement {position: absolute; bottom: 0px; right: 0px;}
</style>
<div class="reventEventsWrapper">
<div class="recentEventsDetail"></div>
<div class="recentEventsLowerLeftElement"></div>
<div class="recentEventsLowerRightElement"></div>
</div>

在包装器上使用相对位置使绝对定位的子级使用该 div 的原点来计算位置。这里唯一的问题是你可能有重叠。此外,您可能还想将 padding-bottom 添加到包装器中,使其等于左右 div 的高度。这确保它们永远不会与细节部分重叠。

关于CSS 定位——元素在右下角、左手 Angular ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3965091/

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