删除CSS中的水平滚动条 [英] Remove horizontal scroll bar in CSS

查看:174
本文介绍了删除CSS中的水平滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网页上使用Facebook喜欢的按钮。我需要它在页面的右侧对齐。但是有一个水平滚动条显示。

I am using a facebook like button on my web page. I need it to align at the right side of the page. But there is a horizontal scroll bar displaying.

请参阅小提琴 http://jsfiddle.net/u4kMs /

我找不到原因。如何解决此问题?

I couldn't find out what causes this. How to fix this?

推荐答案

出现滚动条是因为内容对于您的屏幕来说太宽。

The scrollbar appears because the content is too wide for your screen.

只要忽略 div 元素的宽度,它会自动展开为其父级的100%。将Facebook按钮向右浮动,就像您已经做的那样,然后在没有滚动条的情况下正确对齐按钮。

Just omit the width on the div element, it will auto-expand to 100% of it's parent. Floating the facebook button to the right like you already did should then align the button correctly without scrollbar.

如果您没有得到满意的解决方案,您仍然可以声明<$

If you don't get a satisfying solution you can still declare overflow:hidden on the containing div to supress the scrollbars.

这将是结果: http://jsfiddle.net/poikl/u4kMs/8/

这篇关于删除CSS中的水平滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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