网站宽度无法正确显示

时间:2015-06-30 18:31:46

标签: html css twitter-bootstrap web width

正如你在这个链接上看到的那样(http://riksblog.com/Marnik/index.html),由于某种原因,身体和网站的宽度是应该的,但是我的网站旁边有一个奇怪的空白空间比它应该更广泛。

我使用bootstrap,因此我无法在css中使用像桌面版本的媒体查询这些技巧。

2 个答案:

答案 0 :(得分:2)

你正在寻找溢出的css属性试试这个:

body {
overflow-x: hidden;
}

完全删除问题摆脱了这个类的正确填充:

section.first .section-content {
padding: 150px 15px //remove left/right padding
}

答案 1 :(得分:1)

问题是这个css:

section.first .section-content {
    position: relative;
    width: 100%;
    padding: 150px 15px;
    text-align: center;
}

导致.section-content div与其父级加30px一样宽。

可能的解决方案是在样式

中添加box-sizing属性
    box-sizing: border-box;

或更改宽度,使其不超过其父级

    width: calc(100% - 30px);
相关问题