I have table made of divs and I have a header and body, inside the body im doing iteration of the component. it works fine but I want to make the header not to scroll down when I scroll I tried many different options and they ruined my misplaced the table cells some options I have tried are
Make div and table header fixed on scroll
How to add a scrollbar to an HTML5 table?
here is my table
<div class="divTable">
<div class="divTableHeading">
<div class="divTableRow">
<div class="divTableHead">Email</div>
<div class="divTableHead">Date</div>
<div class="divTableHead">Id</div>
</div>
</div>
<div class="divTableBody">
<div class="divTableRow">
<aura:iteration items="{!v.workList}" var="work" indexVar="index">
<div class="divTableRow">
<c:AdminHours userEmail="{!v.userEmail}" changedDate="{!v.changedDate}" a recordId="{!v.recordId}" />
</div>
</aura:iteration>
</div>
</div>
</div>
This is my css
.THIS .divTable{
display: table;
width: 100%;
}
.THIS .divTableRow {
display: table-row;
}
.THIS .divTableHeading {
display: table-header-group;
}
.THIS .divTableCell,.THIS .divTableHead {
border: 1px solid #dddddd;
display: table-cell;
padding: 3px 10px;
}
.THIS .divTableHeading {
display: table-header-group;
font-weight: bold;
background-color: #f3f2f2;
}
.THIS .divTableBody {
display: table-row-group;
}