Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Position sticky doesn't work on mozilla neither in safari

Position sticky doesn't work on mozilla neither in safari browser, but in chrome it's working perfectly. Is anyone there who can help me.. I know it we can make it don't by many others way which is "javaScript" but I don't wanna use javaScript in it.

table thead th { position: -webkit-sticky; position: sticky; top: -1px; background: #ccc;}
.table-div {max-height: 200px; overflow: auto;}
.table-div table td {min-width: 200px;}
    <div class="container">
    <div class="row nopadding">
    <div class="table-div table-responsive">
    <table class="table table-bordered">
        <thead>
            <th>head1</th>
            <th>head1</th>
            <th>head1</th>
            <th>head1</th>
        </thead>
        <tbody>
            <tr>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
            </tr>
            <tr>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
            </tr>
            <tr>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
            </tr>
            <tr>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
                <td style="height: 50px;"></td>
            </tr>
        </tbody>
     </table>
     </div>
     </div>
     </div>
like image 390
Israr ahmad Avatar asked Nov 23 '25 16:11

Israr ahmad


1 Answers

Position: sticky is not a standard, so it may works, depending of the browser and the version, or even you need to set some flags in web browser config.

You can check this availavility here:

http://caniuse.com/#feat=css-sticky

As you can see, in known issues:

Chrome, Firefox and Safari 7 & below do not appear to support sticky table headers. (see also Firefox bug)

like image 133
Diego N. Avatar answered Nov 25 '25 10:11

Diego N.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!