I am trying to position the triangle over the table cell edge on both end. But half part of triangle is hidden. I tried to apply z-index as well but no impact. Can someone throw light what could go wrong here?
[![enter image description here][1]][1]Expected
[![enter image description here][2]][2]
Here is my Angular code
<td *ngFor="let col of getNumberRange(1, maxDuration)" style="padding: 0;">
<div style="position: relative;">
<div *ngIf="col == 1" class="triangle-up"></div>
<div *ngIf="col == 1" class="start-abbreviation">START</div>
<div *ngIf="col == 5" class="end-abbreviation">END</div>
<div *ngIf="col == 5" class="triangle-down"></div>
<div *ngIf="col >= 1 && col <= 5
style="height: 15px; background-color: #1f4166; padding-top: 5px;"></div>
</div>
</td>
CSS
.triangle-up {
display: inline-block;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 10px solid #ff6600;
position: absolute;
top: 0;
left: -5px;
z-index: 1;
}
.start-abbreviation {
display: inline-block;
margin-left: 5px;
position: absolute;
top: 0px;
color: white;
left: 0;
z-index: 99999999999;
}
.triangle-down {
display: inline-block;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 10px solid #ff6600;
position: relative;
top: -13px;
}
.end-abbreviation {
display: inline-block;
margin-right: 5px;
position: absolute;
top: 0px;
color: white;
left: 0;
z-index: 99999999999;
}```
[1]: https://i.stack.imgur.com/8eIYe.png
[2]: https://i.stack.imgur.com/HXkUh.png
2
Answers
It might be due to the fact that the container does not have
overflow: visible
so we can just add the CSS to the parents, which will allow the arrow to be visible. Also made some extra CSS to make the output look like the screenshot!css
Stackblitz Demo
Make sure to adjust the top and bottom values for .triangle-up and .triangle-down respectively to ensure they align correctly with the edges of the table cell.