gpt4 book ai didi

html - 居中对齐 div 的内容

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

我有一个 width:100%; 的 div,因为我想填充父容器。
我还想在其中心放置 div 的内容。我找不到 div 的 horizo​​ntal-align:center 属性。如何配置 div 以使其内容位于中心?
即如果 div 有这么大:

------------------------------------------------------------------------------------------------------------  
Enclosing tags here
in the center
------------------------------------------------------------------------------------------------------------

最佳答案

试试这个:

div {
margin:0 auto;
}

关于html - 居中对齐 div 的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19903130/

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