html - 如何完全去除边距并使 div 全宽

标签 html css

你好,我正在处理一个页面,我使用 html 和 css 使用了 2 列和 1 行的响应式网格

网格工作正常,但后来我注意到此网格的左侧和右侧有一个边距。

我正试图消除这个边距,但对我来说没有用

<style>
/*  SECTIONS  */
.section {
    clear: both;
    padding: 0px;
    margin: 0px;
}

/*  COLUMN SETUP  */
.col {
    display: block;
    float:left;
    margin: 1% 0 1% 0%;
}
.col:first-child { margin-left: 0; }

/*  GROUPING  */
.group:before,
.group:after { content:""; display:table; }
.group:after { clear:both;}
.group { zoom:1; /* For IE 6/7 */ }

/*  GRID OF TWO  */
.span_2_of_2 {
    width: 100%;
}
.span_1_of_2 {
    width: 50%;
}

/*  GO FULL WIDTH AT LESS THAN 480 PIXELS */

@media only screen and (max-width: 480px) {
    .col { 
        margin: 1% 0 1% 0%;
    }
}

@media only screen and (max-width: 480px) {
    .span_2_of_2, .span_1_of_2 { width: 100%; }
}

</style>


<div class="section group">
    <div class="col span_1_of_2">
    This is column 1
    </div>
    <div class="col span_1_of_2">
    This is column 2
    </div>
</div>

在 madding 和 padding 都设置为零的情况下,请问我如何确保我的网格左右两侧的边距关闭。 这是页面的链接和屏幕截图

http://andymurphy.tv/index.php/landing/

enter image description here

最佳答案

试试这个:

body {

 margin : 0;

}

关于html - 如何完全去除边距并使 div 全宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43737278/

相关文章:

jquery - 想连续显示4张图片,每张图片下方都有描述

jquery - toggleClass() 在 IE11 中不起作用,但似乎在所有其他浏览器中都起作用

显示元素之前的 Javascript 样式

html 选择下拉滚动条 - 仅当存在下拉框时

jquery - 如何制作一个宽度动态调整的html表格

html - 如何将放置在 iFrame 内的 div 定位在屏幕中央

html - 当内容框一分为二时,边框选项卡不会展开

javascript - 从 JavaScript.push 方法显示工具提示

javascript - onmouseover 事件显示和隐藏侧边菜单的滚动条

javascript - 如何在 HTML 中添加表单验证?