I am trying to create a couple boxes with text inside and a line that connects them all. I created a class for each box like this:
.box {
background: white;
border: 1px solid black;
color: black;
border-radius: 8px;
padding: 8px 20px;
margin: 20px;
}
And then to create a couple boxes I have this:
<div fxLayout="row" fxLayoutAlign="space-between">
<div class="box" *ngFor="let box of boxes" fxLayout="column" fxLayoutAlign="start center">
<div>
{{box.firstText}}
</div>
<div>
{{box.secondText}}
</div>
</div>
</div>
I am trying to add a horizontal line that connects each box so I tried to add a <hr>
tag at the end of the box in each loop like this:
<div fxLayout="row" fxLayoutAlign="space-between">
<div class="box" *ngFor="let box of boxes" fxLayout="column" fxLayoutAlign="start center">
<div>
{{box.firstText}}
</div>
<div>
{{box.secondText}}
</div>
<hr> //Addded here
</div>
</div>
But this line doesn't show up anywhere
The
hr
doesn't show between because it is within the column layout, so it is being added at the bottom of the inside of the.box
.The
hr
should be a child of therow
structure because we want it next to the boxes, but we also want it to be repeated between each box, so it must be in thengFor
. We can use ang-container
to hold the for loop (and it will be invisible in the dom, so fxLayout doesn't affect it).I also added
center
to thefxLayoutAlign
to vertically center thehr
.And in the
ngFor
I added; let l=last
to be able to hide the last hr with angIf
.Here is the result: