[英]How do I get rid of the horizontal scroll bar at the bottom?
The problem is in your .slideshow
definition (style.css:199...). 问题出在您的
.slideshow
定义中(style.css:199 ...)。
The browser tries to solve the formula: 浏览器尝试求解公式:
left
+ margin-left
+ border-left-width
+ padding-left
+ width
+ padding-right
+ border-right-width
+ margin-right
+ right
= parent width
and fails because left
is 50% and width
is 100%. 并失败,因为
left
为50%, width
为100%。 Your use of margin:-800px
won't help on a device with display width of 1920px, as (1920*1.5 - 800) is 2080 and thus too wide for a device of that size. 使用
margin:-800px
在显示宽度为1920px的设备上无济于事,因为(1920 * 1.5-800)为2080,因此对于该尺寸的设备而言太宽了。
Use the following definition instead, as it will implicit create a element with an width
of 100%. 请改用以下定义,因为它将隐式创建一个
width
为100%的元素。
.slideshow{
z-index: -9999;
position: absolute;
top: 0;
left: 0;
right: 0;
}
See also CSS Positioned Layout Module Level 3: Section 7.1 . 另请参见CSS位置布局模块级别3:第7.1节 。 Keep in mind, that even when you use the technique described above users with a display width of less than 1024px will have a scrollbar.
请记住,即使您使用上述技术,显示宽度小于1024px的用户也将具有滚动条。 For this issue try
body{overflow-x:hidden;}
. 对于此问题,请尝试
body{overflow-x:hidden;}
。
Your old code (don't use it! only for completion): 您的旧代码(请勿使用它!仅用于完成操作):
.slideshow{
z-index: -9999;
position: absolute;
top: 0;
left: 50%;
width: 100% !important;
margin-left: -800px;
}
这应该摆脱它,只是在devtools中尝试过。
body { overflow-x: hidden; }
overflow-x:hidden;
overflow-y:auto;
should do it. 应该这样做。
or to be on the safe side, to cover browsers that might not support that: 或出于安全考虑,以涵盖可能不支持的浏览器:
overflow:auto;
overflow-x:hidden;
You can do as Mr. Pallazzo said, but this will chop off all content to the right side (that you're now having to scroll to see) which you probably don't want. 您可以按照Pallazzo先生所说的做,但是这会将所有内容切掉到右侧(您现在必须滚动才能看到),而这可能是您不想要的。 Please take a good look instead at the width specifications of the wrapper divs etc. Your div called
wraper
has a width
set as 1003px. 请包装的div等你的DIV称为宽度规格好好看看,而不是
wraper
具有width
设置为1003px。 It is best not to set dimensions in such absolute terms, and instead use percentages. 最好不要以这样的绝对术语设置尺寸,而应使用百分比。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.