简体   繁体   English

居中对齐操作表文本和图标

[英]Center align the actionsheet text and icons

I am trying to centre align the text and icons in action sheet in ionic 3,In the list view its by default aligned to the left. 我正在尝试在ionic 3的操作表中居中对齐文本和图标,在列表视图中默认情况下将其向左对齐。 here is my code: 这是我的代码:

    buttons: [
      { text: 'Delete', role: 'destructive' },
      { text: 'Share' },
      { text: 'Play' },
      { text: 'Favorite' },
      { text: 'Cancel', role: 'cancel' }
    ]

You can add your custom css class to the buttons. 您可以将自定义css类添加到按钮。 For example: 例如:


.center {
   text-align: center; 
   vertical-align: middle;
}

Then add this css class to your code like this: 然后将此css类添加到您的代码中,如下所示:

buttons: [
      { text: 'Cancel', 
        role: 'cancel',
        cssClass: 'center'
       }
 ]

Try adding a custom class to your buttons. 尝试将自定义类添加到您的按钮。

For instance: 例如:

.customCenter {
     display: flex;    
     align-items: center;    
     justify-content: center; 
 }

{ text: 'Delete', role: 'destructive', class: 'customCenter' },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM