enter image description here
I am having a bug like in the picture, when has many . To make the code responsive, has overflow-x: auto, but the extra part is not applying css code of .
My JSX code:
<div className="profile-flights-list">
<div className="profile-flights-list-row">
<div className="profile-flights-column departure-time">Thời gian xuất phát</div>
<div className="profile-flights-column arrival-time">Thời gian đến</div>
<div className="profile-flights-column departure-location">
Địa điểm xuất phát
</div>
<div className="profile-flights-column arrival-location">Địa điểm đến</div>
<div className="profile-flights-column passenger-info">Thông tin người bay</div>
<div className="profile-flights-column ticket-info">Thông tin vé</div>
<div className="profile-flights-column status">Trạng thái</div>
<div className="profile-flights-column cancel">Hủy vé</div>
</div>
<div className="profile-flights-list-body">
</div>
And the has many
My CSS code:
.profile-flights-list {
margin: 1rem 1rem 1rem 1rem;
border: 1px solid #ccc;
border-radius: 10px;
font-size: 0.9rem;
overflow-x: auto;
}
.profile-flights-list > .profile-flights-list-row:first-child {
background-color: #cce1b1;
font-weight: 700;
}
.profile-flights-list-row {
display: grid;
grid-template-columns: minmax(5rem, 2fr) minmax(5rem, 2fr) minmax(5rem, 2fr) minmax(5rem, 2fr) minmax(15rem, 6fr) minmax(7.5rem, 3fr) minmax(5rem, 2fr) minmax(2.5rem, 1fr);
align-items: center;
border-bottom: 1px solid #ccc;
text-align: center;
flex-shrink: 0;
}
.profile-flights-list-row:last-child {
border-bottom: none;
}
Thanks for reading!, if you need anymore information, please let me know!
I am not too experienced in coding frontend for website so I haven’t come up with any solution yet.
2
Answers
If you are concerned about the background color then give
overflow-x: auto
property to.profile-flights-list-row
class.In your code, you can add the profile-flights-list to the overflow property so the child element of the profile-flights-list is the profile-flights-list-row, so that element does not apply to the full row element; it just only applies to the screen heading.
So apply the overflow property to the profile-flights-list-row so that all child elements apply to CSS when you scroll.