Разбираемся в CSS
-
Anonymous
Почему установление цвета фона в липком заголовке не работает после прокрутки?
Сообщение
Anonymous »
Код: Выделить всё
.table__container {
position: relative;
}
.table__header {
position: sticky;
top: 0;
background-color: red;
z-index: 1;
}
.table__header,
.table__body--row {
display: flex;
}
.table__header--cell,
.table__body--cell {
flex-shrink: 0;
flex-basis: 400px;
border: solid 1px black;
padding: 8px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
box-sizing: content-box;
}
.table__container {
width: 1000px;
height: 600px;
overflow: auto;
}< /code>
Column 1
Column 2
Column 3
Column 4
Column 5
Column 6
Column 7
Column 8
Column 9
Column 10
Row 1 Column 1
Row 1 Column 2
Row 1 Column 3
Row 1 Column 4
Row 1 Column 5
Row 1 Column 6
Row 1 Column 7
Row 1 Column 8
Row 1 Column 9
Row 1 Column 10
Фон заголовка не применяется после горизонтальной прокрутки.
p> p> pre.1
Подробнее здесь:
https://stackoverflow.com/questions/796 ... r-scrollin
1750205861
Anonymous
[code] .table__container {
position: relative;
}
.table__header {
position: sticky;
top: 0;
background-color: red;
z-index: 1;
}
.table__header,
.table__body--row {
display: flex;
}
.table__header--cell,
.table__body--cell {
flex-shrink: 0;
flex-basis: 400px;
border: solid 1px black;
padding: 8px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
box-sizing: content-box;
}
.table__container {
width: 1000px;
height: 600px;
overflow: auto;
}< /code>
Column 1
Column 2
Column 3
Column 4
Column 5
Column 6
Column 7
Column 8
Column 9
Column 10
Row 1 Column 1
Row 1 Column 2
Row 1 Column 3
Row 1 Column 4
Row 1 Column 5
Row 1 Column 6
Row 1 Column 7
Row 1 Column 8
Row 1 Column 9
Row 1 Column 10
[/code]
Фон заголовка не применяется после горизонтальной прокрутки.
p> p> pre.1
Подробнее здесь: [url]https://stackoverflow.com/questions/79668941/why-does-setting-the-background-color-in-a-sticky-header-not-work-after-scrollin[/url]