是否可以将 position: sticky 应用于 <thead> 或 <tr> 元素?
Is it possible to apply position: sticky to <thead> or <tr> element?
是否可以将 position: sticky
应用于 <thead>
或第一个 <tr>
标签,使 table header 在滚动时卡在视口顶部table body?
否。 specification 摘要明确指出:
Other kinds of layout, such as tables, "floating" boxes, ruby annotations, grid layouts, columns and basic handling of normal "flow" content, are described in other modules.
是的,可以将 position: sticky
应用于 thead
或 tr
元素。 position
property 可以应用于
all elements except table-column-group and table-column
但是不,它不会像你想要的那样:
The effect of position: sticky
on table elements is the same as for
position: relative
是否可以将 position: sticky
应用于 <thead>
或第一个 <tr>
标签,使 table header 在滚动时卡在视口顶部table body?
否。 specification 摘要明确指出:
Other kinds of layout, such as tables, "floating" boxes, ruby annotations, grid layouts, columns and basic handling of normal "flow" content, are described in other modules.
是的,可以将 position: sticky
应用于 thead
或 tr
元素。 position
property 可以应用于
all elements except table-column-group and table-column
但是不,它不会像你想要的那样:
The effect of
position: sticky
on table elements is the same as forposition: relative