gpt4 book ai didi

css - 内联 CSS 不居中

转载 作者:太空宇宙 更新时间:2023-11-04 05:23:54 25 4
gpt4 key购买 nike

我已经在 stackoverflow 上阅读了关于居中的其他问题并且之前使用过这种技术。

我尝试使用:

<div style="width: 1000px; position: absolute; margin: 300px auto 0px auto;">
content in here
</div>

这并没有使 div 居中。我做错了什么?感觉以前用过这段代码,这次不行了。我尝试制作一个新的 html 文件,我尝试了它以防我在这个特定页面上做错了什么。它也有缺陷。怎么错了?

最佳答案

去掉position: absolute

jsFiddle .

顺便说一句,这与内联样式无关。

关于css - 内联 CSS 不居中 <div>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5710378/

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