我在Ionic 2中创建了一个按钮,如下所示:
<button secondary block round padding style="text-align : left;">
<ion-icon ios="ios-key" md="md-key"></ion-icon>
Login
</button>
我正在尝试将按钮文本对齐到左侧,但它没有到达那里。有内置的twik可以实现吗?
Ionic将按钮的内容包装到<span>
具有class的标签中.button-inner
。因此,HTML标记在您检查时看起来像这样
<button secondary block round padding>
<span class="button-inner">
<ion-icon ios="ios-key" md="md-key" item-right></ion-icon>
Login
</span>
<ion-button-effect></ion-button-effect>
</button>
本.button-inner
类应用Flexbox的属性文字和图标的中心位置。您可以覆盖justify-content
属性并将值从更改center
为flex-start
,这将告诉内容(文本和图标)从框的开头开始。
例子
如果您想将其应用于所有按钮
.button-inner{
justify-content:flex-start;
}
如果要将其应用于特定的按钮(其中.specific-button
作为类添加到按钮组件中)
.specific-button .button-inner{
justify-content:flex-start;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句