overflow-y: scroll not working in firefox

2019-06-13 19:58发布

问题:

Kindly refer to URL : http://jsfiddle.net/8tFnG/1/

<table border="1" cellspacing="0" cellpadding="1" width="100%">
    <colgroup>
        <col span="1" style="width:5%">
            <col span="1" style="width:70%">
                <col span="1" style="width:25%">
    </colgroup>
    <tr>
        <td colspan="2">
            <div style="width:100%; box-shadow: 1px 1px 1px #cfcfcf; border-radius:10px; color:black; border:1px solid #e5e5e5; min-height: 100px;">Sample Text 1</div>
        </td>
        <td rowspan="5" style="vertical-align: top;">
            <section class="loginform">
                <fieldset style="border-radius: 5px; padding: 5px;height: 450px; border: solid 1px red; overflow: auto;">
                    <legend>Template</legend>
                    <ul style="padding: 10px;">
                        <li>one</li>
                        <li>Two</li>
                        <li>Three</li>
                        <li>Four</li>
                        <li>Five</li>
                        <li>one</li>
                        <li>Two</li>
                        <li>Three</li>
                        <li>Four</li>
                        <li>Five</li>
                        <li>one</li>
                        <li>Two</li>
                        <li>Three</li>
                        <li>Four</li>
                        <li>Five</li>
                        <li>one</li>
                        <li>Two</li>
                        <li>Three</li>
                        <li>Four</li>
                        <li>Five</li>
                        <li>one</li>
                        <li>Two</li>
                        <li>Three</li>
                        <li>Four</li>
                        <li>Five</li>
                    </ul>
                </fieldset>
            </section>
        </td>
    </tr>
    <tr>
        <td>val</td>
        <td>
            <div style="width:100%; box-shadow: 1px 1px 1px #cfcfcf; color:black; border:1px solid #e5e5e5; min-height: 80px;">1 Only</div>
        </td>
    </tr>
    <tr>
        <td>bal</td>
        <td>
            <div style="width:100%; box-shadow: 1px 1px 1px #cfcfcf; border-radius:10px; color:black; border:1px solid #e5e5e5; min-height: 80px;">2 only</div>
        </td>
    </tr>
    <tr>
        <td>nal</td>
        <td>
            <div style="width:100%; color:black; box-shadow: 1px 1px 1px #cfcfcf; border-radius:10px; color:black; border:1px solid #e5e5e5; min-height: 80px;">Both 1 and 2</div>
        </td>
    </tr>
    <tr>
        <td>dul</td>
        <td>
            <div style="width:100%; box-shadow: 1px 1px 1px #cfcfcf; border-radius:10px; color:black; border:1px solid #e5e5e5; min-height: 80px;">Neither 1 nor 2</div>
        </td>
    </tr>
    <tr>
        <td></td>
        <td></td>
    </tr>
</table>

overflow-y: scroll not working in firefox; any idea to fix same? [You can look at template section on right hand side]

回答1:

This is a bug. The overflow property is not implemented on fieldsets in firefox. Do you have to use a fieldset? If not I would suggest changing it to a div:

Change:

<fieldset style="border-radius: 5px; padding: 5px;height: 450px; border: solid 1px red; overflow: auto;">

to:

<div style="border-radius: 5px; padding: 5px;height: 450px; border: solid 1px red; overflow: auto;">


回答2:

You should mention the overflow for the section not the fieldset.

<section class="loginform" style="overflow-y: auto;">

And add height: auto for fieldset, so that the content doesn't flow outside.

<fieldset style="border-radius: 5px; padding: 5px;height: 450px; border: solid 1px red; height: auto">

Check this fiddle http://jsfiddle.net/Ajey/ZK3yJ/



回答3:

Set overflow:auto on the section: .loginform (the parent element of the fieldset)

UPDATED FIDDLE

.loginform
{
    height:450px;
    overflow: auto;
}