I am trying to have a triangle/arrow
at the right of arrow-td
. Initial plot with the code below works but the triangle/arrow
doesn't scroll with its container arrow-td
.
How could I keep the triangle positioned relative to arrow-td
even when the user scrolls through main-div
?
NOTE: The arrow
should stay outside (just right) of main-div
. Adding position: relative
to arrow-td
won't work as that would force arrow
to be inside of main-div
since overflow-y: auto
is activated on main-div
.
Check out the plunker
HTML
<div class="main-div">
<table>
<tbody>
<tr>
<td>Hello</td>
</tr>
<tr>
<td>Hello</td>
</tr>
<tr>
<td class="arrow-td">
<div class="left-of-arrow">With arrow</div>
<div class="arrow"></div>
</td>
</tr>
.........
</tbody>
</table>
</div>
CSS
.main-div{
height: 200px;
width: 200px;
overflow-y: auto;
}
table{
width: 100%;
max-width: 100%;
}
td{
width: 100%;
background-color: #eee;
display: flex;
}
td>div{
display: flex;
}
.arrow{
right: 300px;
position: absolute;
width: 0;
height: 0;
border-top: 12px solid transparent;
border-bottom: 12px solid transparent;
border-right: 12px solid red;
}