Fieldset contents overflow in Firefox

一世执手 提交于 2019-12-06 04:10:28

问题


I am having a css issue with fieldset and wonder if you could help?

I have a fieldset with width smaller than its content div's width.

I want the fieldset to display a horizontal scroll bar as the content is too wide but it only works in IE's not Firefox.

Thanks in advance.

Eric

This is the html

<fieldset style=" width:150px; overflow:scroll;" >
    <div style="width:200px; height:50px; background:red;">
        Contents...
    </div>
</fieldset>

回答1:


The best thing I can come up with is to put 2 nested divs within the fieldset:

<fieldset style="width:150px" >
    <div style="width: 150px; overflow-x:scroll;">
        <div style="width:200px; height:50px; background:red;">
            Contents...
        </div>
    </div>
</fieldset>



回答2:


Try this:

<fieldset style=" width:150px;">
    <div style="width:200px; height:50px; background:red; overflow:scroll;">
        Contents...
    </div>
</fieldset>



回答3:


As others have already mentioned, this is a bug in Firefox: Bug 261037 - overflow property not implemented on fieldset (reported in 2004, and still not fixed)




回答4:


I had the same problem. FF does not allow overflow: hidden on fieldset tags regardless if you use overflow-y or overflow-x. My fix was using '-moz-hidden-unscrollable'. Like this...

fieldset{
    overflow: -moz-hidden-unscrollable;
}

It is a dirty hack but it works.

re: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#Values



来源:https://stackoverflow.com/questions/3137741/fieldset-contents-overflow-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!