gpt4 book ai didi

javascript - 使用 js/jQuery/css 覆盖 !important 重力形式?

转载 作者:行者123 更新时间:2023-11-28 17:12:21 25 4
gpt4 key购买 nike

我正在尝试覆盖 wordpress 中使用 !important 的重力网络表单中的样式

我试图覆盖的代码是 <label class="gfield_label" for="input_1_20">Street Name<span class="gfield_required">*</span></label>

该部分的 CSS 是;

.gfield_label {
margin: 10px 0 20px 0 !important;
font-weight: bold;
color: #000;
display: inline-block;
line-height: 1.2em;
clear: both;
}

我很乐意用 class="gfield_label"覆盖所有内容

我已经尝试了以下但没有成功;

一个

jQuery('gfield_label').attr('style', 'margin: 15px 0 5px 0 !important;');

两个

( '.gfield_label' ).each(function () {
this.style.setProperty( 'margin', '15px', '0', '5px', '0', '!important' );
});

三个

jQuery( ".gfield_label" ).css( "cssText", "margin: 15px 0 5px 0 !important;" );

四个

label[for=input_1_20] .gfield_label {
margin: 15px 0 5px 0 !important;
}

我已经在网站上测试了 jQuery,它可以正常工作。

自定义 CSS 和 jQ 在页面底部加载,在重力表单使用的 css 文件链接之后。

非常感谢任何帮助!

最佳答案

转到插件的设置并将“输出 css”切换为“否”。

这些人必须学习如何设计风格。他们所有的!importants让我头疼

关于javascript - 使用 js/jQuery/css 覆盖 !important 重力形式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29030123/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com