【发布时间】:2018-12-31 04:59:14
【问题描述】:
我正在努力尝试使用一些基于 mat-list-items 的两行设置 mat-nav-list。第一行应该是水平居中的图像,第二行也是居中的标题文本。我都显示了,但 img/icon 没有居中。 :/
这里有一些代码:
<mat-nav-list class="list-container">
<a mat-list-item routerLink="/somewhere" routerLinkActive="active-link">
<span matLine class="icn_log"></span>
<span matLine>Centered Text</span>
</a>
</mat-nav-list>
我也使用了一些样式,更多的是用于关闭填充并添加一些边框。但是我怎样才能给带有图标的第一个跨度命令也让其居中呢?:
.list-container {
width: 100%;
padding-top: 1px;
border-right: 1px solid;
border-color: #ddd;
text-align: center;
}
.list-container .mat-list-item {
border: 1px solid;
border-right: 0px;
border-color: #ddd;
margin-top: -1px;
height: 80px;
}
.list-container .mat-list-item .mat-line {
padding-top: 5px;
padding-bottom: 5px;
}
.icn_log {
height: 32px;
width: 32px;
background-repeat: no-repeat;
background-image: url("assets/img/log.png");
background-position: 0;
}
【问题讨论】:
标签: html css angular angular-material angular6