简体   繁体   English

无法覆盖CSS属性

[英]Unable to override css property

Hi I have provided with a project which has many CSS files included. 嗨,我提供了一个包含许多CSS文件的项目。 with following structure 具有以下结构

<link href="./Premium Nutritional Supplements_files/jquery.owl.carousel.css" rel="stylesheet" type="text/css" media="all">
  <link href="./Premium Nutritional Supplements_files/jquery.fancybox.css" rel="stylesheet" type="text/css" media="all">
  <link href="./Premium Nutritional Supplements_files/jquery.fancybox-buttons.css" rel="stylesheet" type="text/css" media="all">

  <link href="./Premium Nutritional Supplements_files/bootstrap.min.css" rel="stylesheet" type="text/css" media="all">
  <link href="./Premium Nutritional Supplements_files/bootstrap-modal.css" rel="stylesheet" type="text/css" media="all">
  <link href="./Premium Nutritional Supplements_files/bootstrap-switch.css" rel="stylesheet" type="text/css" media="all">

  <link href="./Premium Nutritional Supplements_files/kumi.global.css" rel="stylesheet" type="text/css" media="all">
  <link href="./Premium Nutritional Supplements_files/kumi.style.scss.css" rel="stylesheet" type="text/css" media="all">
  <link href="./Premium Nutritional Supplements_files/kumi.media.css" rel="stylesheet" type="text/css" media="all">
   <link href="./Premium Nutritional Supplements_files/custom.css" rel="stylesheet" type="text/css" media="all">

I have included custom.css at the end to override a property 我在最后包含了custom.css以覆盖属性

.post-author-image{
    border-radius: 50%;
}

in kumi.global.css which is above custom.css and contains custom.css上方的kumi.global.css中并包含

div, input, select, textarea, span, img, table, td, th, p, a, button, ul, li {
    -webkit-border-radius: 0 !important;
    -moz-border-radius: 0 !important;
    border-radius: 0!important;
}

But I m unable to override border-radius in custom.css. 但是我无法覆盖custom.css中的border-radius。 How can I override border-radius from 0 to 50%? 如何覆盖0至50%的边界半径?

using !important should do it since custom.css loads at last. 使用!important应该这样做,因为custom.css最终加载了。

.post-author-image{
    border-radius: 50% !important;
}

!important gives css a higher priority and since "kumi" css has !important , no matter where you put your custom css, "kumi" css will take effect. !important赋予css更高的优先级,并且由于“ kumi” css具有!important ,因此无论您将自定义css放在何处,“ kumi” css都将生效。

It is generally a bad idea to use !important especially when you are selecting a generic dom element which is in your case with "kumi css" where !important is used for almost everything. 使用!important通常是一个坏主意,尤其是当您选择通用dom元素时(对于您的情况是“ kumi css”),其中!important几乎用于所有情况。

If possible, a better solution will be to remove !important from "Kumi" css 如果可能,更好的解决方案是从“ Kumi” css中删除!important

Woah. 哇。 I hope that you can change kumi.global.css, because that !important tag is put to horrific use. 我希望您可以更改kumi.global.css,因为!important标记已被可怕地使用。 It almost seems like a hard-artillery approach to banning use of border-radius. 禁止边界半径的使用似乎几乎是一门大炮。

Here's the direct solution: 这是直接的解决方案:

.post-author-image{
    border-radius: 50% !important;
}

But I hope you're able to remove that tag from the global file. 但我希望您能够从全局文件中删除该标签。

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

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