<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 3 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 3 年前。
我为我的网页设计类(class)创建了一组 HTML 页面,但我有意设计它们,以便它只在我的笔记本电脑上看起来不错。我的一个页面有一个 p 标签,它以 66% 的左属性居中,效果非常好。但是,当我在更大的屏幕(如桌面显示器)上查看它时,它的居中位置不同。
我在宽度、左侧和右侧等不同属性上尝试了许多不同的值,但似乎对两个屏幕都不起作用。我什至尝试使用它包含的 div,但没有成功。
这是 p(abouttext)和 div(abouttextbox)标签的 CSS。
#abouttextbox {
position: relative;
height: 100%;
width: 100%;
}
#abouttext {
position: relative;
font-family: "Georgia", sans-serif;
color: #e8e8e8;
font-size: 1em;
width: 100%;
text-align: center;
opacity: 0;
top: 65%;
}
最佳答案
为什么要将 position: absolute
放在 body
中......为什么为什么......???
我还可以看到你的 #abouttextbox
和 #abouttext
的 css 规则都有 position: relative
...有什么理由position
搞得一团糟??
关于html - CSS 左属性值不能很好地适应不同的窗口大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56307676/