gpt4 book ai didi

html - 使用 html5 文档类型时,如何在 IE 中将元素居中?

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

<!DOCTYPE html>

<html land="en">
<head>
<title></title>
<style>
#container { margin: 0 auto; width: 960px; }
</style>
</head>
<body>
<div id="container"></div>
</body>
</html>

如何在不更改文档类型的情况下让它在 Internet Explorer 中工作?

最佳答案

简单

body {
text-align: center;
}

#container {
text-align: left;
}

关于html - 使用 html5 文档类型时,如何在 IE 中将元素居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3455228/

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