Html 如何扩展具有特定颜色的矩形彩色div?
我在页面上有一个div,背景颜色设置为灰色。如何去除div周围的白色边框,使白色边缘也变成灰色 e、 g.HTML:Html 如何扩展具有特定颜色的矩形彩色div?,html,css,Html,Css,我在页面上有一个div,背景颜色设置为灰色。如何去除div周围的白色边框,使白色边缘也变成灰色 e、 g.HTML: <div id="top-div"> <h1>Some Header</h1> <p> Some text. </p> </div> 当前图形输出: 所需图形输出: 您应该在主CSS文件中使用一些CSS重置。 大概是这样的: *, ::after
<div id="top-div">
<h1>Some Header</h1>
<p>
Some text.
</p>
</div>
当前图形输出:
所需图形输出:
您应该在主CSS文件中使用一些CSS重置。 大概是这样的:
*, ::after, ::before {
box-sizing: border-box;
}
* {
margin: 0;
padding: 0;
}
body {
color: #333;
font-family: "roboto","Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 1.5;
min-height: 100vh;
overflow-x: hidden;
position: relative;
}
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}
在这里可以设置一些默认的css行为
在您的示例中,正文具有默认边距请澄清您的具体问题或添加其他详细信息,以突出显示您需要的内容。正如目前所写的,很难准确地说出你在问什么。
*, ::after, ::before {
box-sizing: border-box;
}
* {
margin: 0;
padding: 0;
}
body {
color: #333;
font-family: "roboto","Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 1.5;
min-height: 100vh;
overflow-x: hidden;
position: relative;
}
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}