简体   繁体   English

如何避免无溢出X的水平滚动:隐藏

[英]How to avoid horizontal scroll without overflow-x: hidden

I'm having an issue with my website: www.csselectronics.com I have set up an overflowing background on my main page. 我的网站有一个问题:www.csselectronics.com我的主页上设置了一个过多的背景。 As a result I get an overflow situation when viewing the site on mobile - ie it is possible to horizontally scroll to the right, which I'd like to avoid. 结果,当我在移动设备上查看网站时,出现了溢出的情况-即可以向右水平滚动,这是我想避免的。

To fix this I've tried using solutions that employ the overflow-x: hidden; 为了解决这个问题,我尝试使用采用了overflow-x的解决方案: feature in the html and body - but when doing so, I encounter some other issues with my hosted platform. html和body中的功能-但是这样做时,我的托管平台遇到了其他一些问题。

Is there another way to solve this than by using the overflow-x: hidden trick? 除了使用overflow-x:隐藏技巧,还有其他解决方法吗?

Thank you! 谢谢!

Martin 马丁

Instead of overflowing the background, I would try using: 我不会尝试溢出背景,而是尝试使用:

background-size: cover;

Or 要么

background-size: contain;

是的,您可以通过使用自适应设计并确保没有任何元素溢出布局的100%来解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM