gpt4 book ai didi

html - 我怎样才能将这个 DIV 恰好放在中间并且在调整浏览器大小时它不移动?

转载 作者:太空宇宙 更新时间:2023-11-04 09:34:49 24 4
gpt4 key购买 nike

您可能需要它,在此先感谢您。还有DIV里面的文字怎么也能放在中间呢?

body {
margin: 0;
}
#questiond {
width: 1080px;
height: 675px;
background-color: white;
position: relative;
margin: auto;
}
#frage1 {
position: absolute;
left: auto;
font-family: 'Roboto', sans-serif;
color: #f09b72
}
<body background="img/bg.jpg">
<div id="questiond">
<h1 id="frage1">Frage 1</h1>
</div>
</body>

最佳答案

你好,我希望你正在寻找下面的这个

#questiond {
position: absolute;
top: 50%;
left: 50%;
margin-left:auto;
margin-right:auto;
width:960px;
<div id="questiond">
<h1 id="frage1">Frage 1</h1>
</div>

关于html - 我怎样才能将这个 DIV 恰好放在中间并且在调整浏览器大小时它不移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40440930/

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