Here are the steps to enable vertical scrolling in tbody and have it automatically fill its containing element:
- Set the height of the containing element that houses the tbody. Since we want vertical scrolling, use a fixed height value. For example:
.containing-element {
height: 300px;
}
- Set the tbody element to be display: block. This will allow the tbody element to have its own height property and enable scrolling within it.
tbody {
display: block;
}
- Set the height of tbody to be 100%. This will ensure that the tbody element stretches to fill the containing element height.
tbody {
display: block;
height: 100%;
}
- Add the CSS property overflow-y: auto to the tbody element. This will enable vertical scrolling within the tbody element.
tbody {
display: block;
height: 100%;
overflow-y: auto;
}
With these CSS properties applied, the tbody element will now have vertical scrolling and automatically fill its containing element height.