gpt4 book ai didi

未应用 CSS 属性

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

<html>
<head>
<style>
#mainbody, #mainbodyloginpage {
left: 35%;
position: relative;
width: 40%;
}
#mainbodyloginpage {
top: 55%;
}
</style>
</head>
<body>
<div id="mainbodyloginpage">
..
..

.. [此处未应用顶级属性] ..

 </div>
</body>
</html>

知道为什么没有应用 top 属性,但应用了 left 等其他属性吗?

更新::一旦我改变

top: 55%;

top: 20px;

它有效。但我不想将其固定为固定值。有人知道这里发生了什么吗?

更新 2::此代码在 IE 中运行良好,但在 firefox/chrome 中运行不佳。即 chrome 和 firefox 忽略设置为百分比的顶级属性。 IE 确实尊重它。

最佳答案

你需要专门设置 position: relative as position: static 是默认的。 top/left/etc 对静态定位元素没有任何影响。

关于未应用 CSS 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7061833/

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