如何将离子标签对齐? [英] How to align ion-label to right?
本文介绍了如何将离子标签对齐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在研究Ionic v2,并面临着将离子标签值对齐的问题。以下是代码段:
I am working on Ionic v2 and and facing issue in aligning ion-label value to the right. Following is the code snippet:
Html代码:
<ion-content padding class="home">
<ion-list>
<ion-item class="clearme">
<ion-label>Employee Name:</ion-label>
<ion-label class="alignme">Gaurav</ion-label>
</ion-item>
</ion-list>
CSS:
.home {
background-color:red;
}
.alignme{
float:right !important;
}
.clearme{
clear: both !important;
}
添加这些类后,文本没有正确对齐。
After adding these classes text is not getting aligned to right.
推荐答案
只需使用text-align而不是float。
Just use text-align instead of float.
.alignme{
text-align: right;
}
你应该只使用离子标签表格 - 离子输入,离子-checkbox等。
Btw you should use ion-label only with forms - ion-input, ion-checkbox etc.
这篇关于如何将离子标签对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文