简体   繁体   English

覆盖* CSS页面中的CSS属性

[英]Override * CSS property in scss Page

I am learning ionic. 我正在学习离子。 In my app I want to make the font of linkbutton to 12 px, however it is overridden by other css. 在我的应用程序中,我想将linkbutton的字体设置为12 px,但是它被其他CSS覆盖。 My scss file has following css for linkbutton: 我的scss文件的linkbutton具有以下CSS:

  .link_button {
  color: $myColor;
  font-size: 12px;
  text-decoration: underline;
  bottom:10px;
  }

How can I make above scss to be implied forcibly on top of others ? 我怎样才能使以上的scss被强行暗示在别人之上?

This is how text looks: 这是文本的外观:

在此处输入图片说明

CSS which is implied in actual(got from chrome tool): 实际暗示的CSS(从chrome工具中获取):

在此处输入图片说明

After suggestion from folks here I modified my scss file with both Id and Important it did not work. 经过人们的建议后,我用Id和Important修改了我的scss文件,但该文件不起作用。 When using important:(And same happens even if I do via Id) 使用重要时:(即使我通过ID进行同样操作) 在此处输入图片说明

You can either add a ID to the link button and specify the style using ID. 您可以将ID添加到链接按钮,然后使用ID指定样式。 This is because ID takes precedence over class styles 这是因为ID优先于类样式

#linkButton { Font-size:12px; } #linkButton { Font-size:12px; } Or you can use !important which will over write all other css styles. #linkButton { Font-size:12px; }或者,您也可以使用!important来覆盖所有其他CSS样式。 But be careful when you use it .linkButton { Font-size:12px !important; } 但是,使用它时要小心.linkButton { Font-size:12px !important; } .linkButton { Font-size:12px !important; }

The best is not to use !important but to increase specificity. 最好不要使用!important,而是要增加特异性。 https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity https://developer.mozilla.org/zh-CN/docs/Web/CSS/Specificity

It was ionic-button who was adding button-inner class and it had default font size. 是ionic-button谁添加了按钮内部类,并且它具有默认字体大小。 More on here: 在这里更多:

css code doesn't apply to button in ionic 2 CSS代码不适用于ionic 2中的按钮

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

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