gpt4 book ai didi

html - 将这个 div 放在它容器的中心?

转载 作者:太空宇宙 更新时间:2023-11-03 21:53:50 25 4
gpt4 key购买 nike

Before you attempt to solve this please carefully read the constraints I'm dealing with.

约束

  1. .pictureContainer 需要保持 position: relative(因为我有一个悬停菜单绝对相对于它定位。)

  2. 图像可能小于 #slide 的 80%,在这种情况下它仍必须居中对齐。这意味着什么?你不能简单地做一个 margin: 0 10% 因为是的,这将使这个特定的情况居中,但它不会满足图像小于 宽度的 80% 的情况#幻灯片

    你好,我是位于另一个内联 block 元素旁边的内联 block 元素,是不是很棒?我觉得那太好了!

最佳答案

为什么不简单地添加:

text-align: center;

到 pictureContainer css 声明。它会将其中的任何图像居中。

关于html - 将这个 div 放在它容器的中心?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15376530/

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