gpt4 book ai didi

html - 如何在 html 中只为屏幕未使用的部分着色?

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

我正在尝试构建一个网页。我要代码

<header>
Some content
</header>
<body>
More content
</body>

放置在屏幕中间,只占屏幕的一小部分屏幕的宽度。我希望屏幕的其余部分为灰色。

基本上,我希望该页面具有与 this one 相似的外观.

这样做的简单方法是什么?

最佳答案

您必须将所有内容包装在 1 个主 div 中并为其指定最大宽度,例如 1200 像素。然后像这样为你的 body 设置颜色:

    body {
background-color: #eee;
}
#main {
max-width: 900px;
background-color: #fff;
margin: 0 auto;
}

关于html - 如何在 html 中只为屏幕未使用的部分着色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52652848/

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