CSS 离子框架无法设置按钮图标大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28158502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 02:56:51  来源:igfitidea点击:

Ionic framework cannot set button icon size

cssiconsionic-frameworkionic

提问by redrom

I would like to set custom icon (ionicons) size for this code:

我想为此代码设置自定义图标(离子)大小:

<button class="button button-icon icon ion-stop customIconSound"></button>

For class customIconSoundi tried following:

对于customIconSound类,我尝试了以下操作:

button.customIconSound,button.button-icon {
    font-size: 52px !important;
    color: #fff;
    line-height: 55px!important;
}

But without luck. If i tried icon class without the button button-iconclass i fount that it is working but without button class icons has not pressed state (because is it not a button).

但没有运气。如果我尝试没有按钮按钮图标的图标类,我发现它正在工作,但没有按钮类图标没有按下状态(因为它不是按钮)。

How can i solve it please?

请问我该如何解决?

Thanks for any advice.

感谢您的任何建议。

回答by Luis Cabrera

Lucas was close but the correct syntax is this one

卢卡斯很接近,但正确的语法是这个

button.customIconSound:before {
    font-size: 22px !important;
}

回答by lucas

If you didn`t solve your problem yet or for people dealing with it in future.

如果您还没有解决您的问题或为将来处理它的人。

You have to change css style for i pseudo element :before

您必须更改 i 伪元素的 css 样式:之前

button.customIconSound i:before {
    font-size: 52px !important;
}

回答by Bellu

Your example is working here.

你的例子在这里工作。

Maybe your problem is caused by something else.

也许您的问题是由其他原因引起的。

PS: If you want only to resize the icon this css line is enough.

PS:如果您只想调整图标大小,此 css 行就足够了。

.customIconSound {
    font-size: 52px;
}

回答by Jesús Castro

Try ruling button-iconclass out. That css class was the trouble in my case. Likewise, as a result, css styles worked on button tag too. For example:

尝试统治button-icon阶级。在我的情况下,那个 css 类是问题所在。同样,因此,css 样式也适用于按钮标签。例如:

<button class="button button-clear ion-edit" style="color:#fff; font-size:22px"></button>