我确定其他人也遇到了这个问题,所以也许你们中的一个已经找到了解决方案!我正在设计一个网站,并且试图在两侧保持边界。我的边距做到了,但是现在顶部有一个边界。我无法消除它,也不知道为什么。有谁知道为什么屏幕顶部的彩色条不会消失?另外,如果您有关于使我的代码更简洁的建议,请随时告诉我。谢谢您的帮助!
@charset "utf-8";
/* CSS Document */
html {
background-color:#0FBDC8;
/*sets the backround html color to teal, this should create vertical teal borders along the side of the document*/
font-family: Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", "serif";
/*sets the font*/
}
body {
background-color: #F8F8F8;
/*sets the body background color, helps create the vertical teal borders along the side of the document*/
margin: 0 auto;
max-width:900px;
}
div.aside {
margin: 2% 5%;
}
div.interesting {
border: 5px solid #11CBD7;
padding: 5% 2%;
}
h2 {
text-align: left;
font-weight:bold;
font-style:italic;
margin: 0% 5%;
}
h3{
text-align: left;
font-weight:bold;
font-style:italic;
margin: 0% 10% 0% 10%;
}
h5 {
text-align: left;
font-weight:bold;
font-style:italic;
margin: 0% 10%;
}
h1 {
text-align: center;
font-weight:bold;
font-style:italic;
margin: 8% 0% 10%;
}
p {
line-height: 1.5em;
margin:2.5% 10%;
text-align: justify;
}
li {
margin: 0 20%;
}
答案 0 :(得分:1)
添加此项以避免浏览器自动添加的默认边距:
html, body {
margin: 0;
}
答案 1 :(得分:0)
无法看到HTML,这只是一个猜测。
while (1) {
scanf("%d", &n);
if (n == -1) break;
sum += n;
i++;
}
由于这是您定义边框的唯一位置,请尝试更改为:
div.interesting {
border: 5px solid #11CBD7;
padding: 5% 2%;
}
请记住,可能是您需要重置样式,然后应用样式表
祝你好运!