【发布时间】:2019-12-12 15:04:51
【问题描述】:
我正在使用 ngFor 显示由水平虚线分隔的项目列表,如下所示:
<div *ngFor="let comment of comments;let lastItem = last;">
<div class="comment-box">
<div class="comment-author">{{comment.createdBy}}</div>
<div class="creation-date">{{comment.createdOn}}</div>
<div class="comment-text">{{comment.text}}</div>
</div>
<div class="dashed-line-box" *ngIf="!lastItem">
<hr class="new1">
</div>
</div>
.dashed-line-box {
position: relative;
background-color: #ffffff;
width: 320px;
height: 16px;
border-style: solid;// to outline the container box
border-width: thin;
}
hr.new1 {
position: absolute;
margin-top: 8px;
border-top: 1px dashed;
}
我可以看到每个虚线框条目的矩形,但它们不像我期望的那样包含水平线。
我在这里错过了什么?
【问题讨论】:
-
您已将虚线框类应用于 div,因此它创建了矩形,只需从 div 中删除该类并尝试