Reputation: 175
I am implementing a tab layout in React. I have a tabs
div which contain two more divs tab-headers
and tab-container
. The tab-container
div contains individual tabs
divs. The content in the tabs
div vary in height and it always shrinks to fit the content. How ever I want the div to be the size of the largest tabs
div. I do not want to use static heights.
This is the css:
.tab-headers{
display: grid;
grid-auto-flow: column;
width: fit-content;
}
.tab-header {
font-size: 1rem;
font-weight: normal;
padding: 5px;
background: var(--primary-bg);
padding: 5px 20px;
}
.tabs-container {
padding: 10px;
}
.tabs{
height: 100%;
background-color: var(--active-bg);
}
.tab{
width: 100%;
height: 100%;
display: none;
}
.active {
display: initial;
}
.active-header {
background-color: var(--active-bg);
border-top: 2px solid var(--accent-bg);
}
.tab-header:hover {
cursor: pointer;
}
Upvotes: 1
Views: 8727
Reputation: 2742
you can use min-height
and max-height
properties in your CSS and set overflow
to scroll
if needed.
Upvotes: 2