Remove horizontal scroll bar in CSS

后端 未结 3 1661
孤街浪徒
孤街浪徒 2021-02-08 16:18

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.

Please see the fidd

相关标签:
3条回答
  • 2021-02-08 17:09

    to disable scroll, try something like;

    .your_div_class{
        overflow-x: hidden;
        overflow-y: scroll;
    }
    
    0 讨论(0)
  • 2021-02-08 17:11

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

    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.

    This would be the result: http://jsfiddle.net/poikl/u4kMs/8/

    0 讨论(0)
  • 2021-02-08 17:15

    It's because the frame is too small for the width that you have set on the top div

    <div style="margin-left:auto; margin-right:auto; width:980px;">
    

    So when this is on your web page yo shouldn't get the horizontal scroller. If you do, then consider changing the above width

    0 讨论(0)
提交回复
热议问题