CSS宽度100%没有工作 [英] CSS width 100% no working

查看:98
本文介绍了CSS宽度100%没有工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个导航栏,设置为宽度100%。它显示完美,但问题是,当它放大时,右侧留下一个空间。您可以在 http://jsfiddle.net/ShNtf/ 中查看工作示例。
以下是我的CSS代码: -

  .nav-container {
width:100%;
颜色:#fff;
背景:#000;
}
.nav-contained {
min-width:350px;
}
}
body {
padding:0;
保证金:0;


解决方案

问题:

当水平滚动条可见时,背景颜色不会填充浏览器宽度。



解决方案:



通过将 background-color 定义移至 .nav-container .nav-contained

  .nav-container {
width:100%;
}
.nav-contained {
min-width:350px;
背景:#000;
颜色:#fff;
}

http://jsfiddle.net/ShNtf/7/


I have a navigation bar that is set to width 100%. It displays perfectly but the problem is that when it is zoomed, a space is left in the right side. You can see the working example at http://jsfiddle.net/ShNtf/ The follwing is my CSS code:-

.nav-container{
    width:100%;
    color:#fff;
    background:#000;
}
.nav-contained{
    min-width:350px;
}
}
body{
    padding:0;
    margin:0;
}

解决方案

Problem:

When a horizontal scroll-bar is visible, background color doesn't fill browser width.

Solution:

I had success by moving the background-color definition to from .nav-container to .nav-contained.

.nav-container {
    width:100%;
}
.nav-contained {
    min-width:350px;
    background:#000;
    color:#fff;
}

http://jsfiddle.net/ShNtf/7/

这篇关于CSS宽度100%没有工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆