在“我的账户页面 – 地址”上使用CSS隐藏表单标签。

huangapple go评论72阅读模式
英文:

Hide form labels with CSS on "My Account Page -> Addresses"

问题

Please check on this picture for a better understanding.

I could hide the input field for Población field which is actually the shipping_city, for this purpose I used:

#shipping_city {
	display: none;
}

and it works!

However, I cannot hide the label Población

I tried:

label[for="shipping_city"] {
	display: none;
}

With no success.

英文:

Please check on this picture for a betther understanding.

I could hide the input field for Población field which is actualy the shipping_city,
for this purpose I used:

#shipping_city {
	display: none;
}

and works!

However, I can not hide the label Población

I tried:

label[for="shipping_city"] {
display: none;
}

With no success

答案1

得分: 0

也许您的标签标签是通过脚本显示的。因此,在您的CSS中添加'!important',就像这段代码一样。

label[for="shipping_code"]{
  display:none;           /* 不起作用 */
  display:none!important; /* 起作用 */
}
英文:

maybe your label tag show with script.
So, add '!important' at your css, like this code.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

$(&quot;label[for=&#39;shipping_code&#39;]&quot;).show();

<!-- language: lang-css -->

label[for=&quot;shipping_code&quot;]{
  display:none;           /* not_woriking */
  display:none!important; /* woriking*/
}

<!-- language: lang-html -->

&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js&quot;&gt;&lt;/script&gt;

&lt;label for=&quot;shopping_code&quot;&gt;test&lt;/label&gt;

<!-- end snippet -->

huangapple
  • 本文由 发表于 2023年5月17日 08:37:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76267876.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定