简体   繁体   English

从 css 中删除 !important

[英]Removing !important from css

I am currently working on a wordpress website.我目前正在 wordpress 网站上工作。 Using woocommerce and this plugin called SMS Alert which allows to send OTP for Registration.使用 woocommerce 和这个名为 SMS Alert 的插件,它允许发送 OTP 进行注册。 This plugin has inserted extra field in my registration form with label 'Phone' and I've enabled dropdown list to select country code.这个插件在我的注册表中插入了额外的字段 label 'Phone' 并且我已经启用下拉列表到 select 国家代码。

The problem is with the css.问题出在 css 上。

<input type="tel" class="input-text phone-valid" name="billing_phone" id="reg_billing_phone" value="" placeholder="Enter Number Here" data-id="sa_intellinput_0" autocomplete="off" style="padding-left:1269px !important;">

The input field is very long because of the 'style' attribute in the code.由于代码中的“样式”属性,输入字段很长。

style="padding-left:1269px;important;" style="padding-left:1269px;重要;"

And it's not going away.而且它不会消失。 I want the padding-left to be 80px.我希望 padding-left 为 80px。 I've tried the following:我试过以下方法:

1. 1.

.page-id-2994 input#reg_billing_phone.input-text.phone-valid {
    width: 515px;
    padding-left: 80px !important;
}
  1. Some Javascript as well from this link一些 Javascript 也来自此链接

  2. Also, I am not able to find the css file for this in file manager.另外,我无法在文件管理器中找到 css 文件。

How do I resolve this issue?我该如何解决这个问题?

You have to use the script to remove the inline style then you need not to use important in your css. Just use:你必须使用脚本来删除内联样式,然后你不需要在你的 css 中使用 important 。只需使用:

document.getElementById('reg_billing_phone').removeAttribute('style');

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

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