如何在离子卡上添加带数字的圆圈 header
How to add circle with number on ion card header
我试图制作一些带有编号的卡片(圆圈内有数字),但似乎有些不对劲。
我不能把它做成圆形和中心
Here's what I want but when I try to make it, it become like this
这是我的一些代码,
<ion-card-header style="padding:0px;border-bottom:1px solid #9c9c9c;">
<ion-row>
<ion-col class="numberCircle">1</ion-col>
<ion-col>John Doe</ion-col>
<ion-col>Posting</ion-col>
</ion-row>
</ion-card-header>
css
.numberCircle {
border-radius: 50%;
width: 25px;
height: 25px;
padding: 4px;
background: #fff;
border: 2px solid #666;
color: #666;
text-align: center;
font: 12px Arial, sans-serif;
}
将数字放在另一个元素中并将其居中会更容易
ion-row.row {
padding: 5px 26px;
justify-content: space-between;
}
ion-row.row ion-col {
flex-grow: 0;
}
.numberCircle {
border-radius: 50%;
width: 25px;
height: 25px;
display: inline-flex;
background: #fff;
border: 2px solid #666;
flex-grow: 0;
padding: 0;
}
.numberCircle span {
color: #666;
text-align: center;
font: 12px Arial, sans-serif;
width: 25px;
display: inline-block;
margin: auto;
}
<ion-card-header style="padding:0px;border-bottom:1px solid #9c9c9c;">
<ion-row>
<ion-col class="numberCircle">
<span>
1
</span>
</ion-col>
<ion-col>John Doe</ion-col>
<ion-col>Posting</ion-col>
</ion-row>
</ion-card-header>
我试图制作一些带有编号的卡片(圆圈内有数字),但似乎有些不对劲。 我不能把它做成圆形和中心
Here's what I want but when I try to make it, it become like this
这是我的一些代码,
<ion-card-header style="padding:0px;border-bottom:1px solid #9c9c9c;">
<ion-row>
<ion-col class="numberCircle">1</ion-col>
<ion-col>John Doe</ion-col>
<ion-col>Posting</ion-col>
</ion-row>
</ion-card-header>
css
.numberCircle {
border-radius: 50%;
width: 25px;
height: 25px;
padding: 4px;
background: #fff;
border: 2px solid #666;
color: #666;
text-align: center;
font: 12px Arial, sans-serif;
}
将数字放在另一个元素中并将其居中会更容易
ion-row.row {
padding: 5px 26px;
justify-content: space-between;
}
ion-row.row ion-col {
flex-grow: 0;
}
.numberCircle {
border-radius: 50%;
width: 25px;
height: 25px;
display: inline-flex;
background: #fff;
border: 2px solid #666;
flex-grow: 0;
padding: 0;
}
.numberCircle span {
color: #666;
text-align: center;
font: 12px Arial, sans-serif;
width: 25px;
display: inline-block;
margin: auto;
}
<ion-card-header style="padding:0px;border-bottom:1px solid #9c9c9c;">
<ion-row>
<ion-col class="numberCircle">
<span>
1
</span>
</ion-col>
<ion-col>John Doe</ion-col>
<ion-col>Posting</ion-col>
</ion-row>
</ion-card-header>