css - 删除包装 div 之前的空格

标签 css

我想删除那里的空格。我是外行用户。如果我犯了一个愚蠢的错误,请原谅我。提前致谢。查看其中有空格的图像并引用代码。 image of design of page

html代码:

    <html>
    <head>
    <title>CSS</title>
    <link href="styles.css" rel="stylesheet">
    </head>

    <body>
    <div id="wraper">

    <div id="header">
    Header
    </div>
    <div id="sidebar">
    Side
    </div>
    <div id="content">
    Content
    </div>
    <div id="footer">
    Footer
    </div>

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

CSS 代码:

    #wraper {
    margin:0 auto;
    width:800px;
    height:1000px;
    background:#FCFCFC;
    }
    #header{
    background:#CFCFC0;
    height:100px;
    width:800px;
    }
    #content {
    float:right;
    width:600px;
    height:700px;
    background:#C0C0C4;
    }
    #sidebar {
    float:left;
    width:200px;
    height:700px;
    background:#CFFCCC;
    }
    #footer {
    clear:both;
    background:#C0CC0C;
    height:200px;
    width:800px;
    }

最佳答案

*{  
  padding:0; 
  margin:0;
}

稍后为每个标签手动提供paddingmargin

关于css - 删除包装 div 之前的空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12670665/

相关文章:

css - 在 H2 内旋转元素

javascript - 如何阻止 jQuery UI 对话框被压扁?

html - 如何在 100% 宽度布局中使用 CSS 定位

css - 隐藏 &lt;textarea&gt; 的 Angular

html - 印度泰米尔字体跨浏览器字体大小问题

javascript - 如何在不与旧样式重叠的情况下使用 JS 添加样式?

css - Internet Explorer 6 中 anchor 水平列表中的文本换行到两行

html - 如何防止自动换行

html - 为什么我的菜单乱七八糟?

css - 当任何 DIV 高度增加时,如何增加两个 DIV 之间的边框高度?