You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用CSS隐藏「我的账户-地址」页面中shipping_city的表单标签?

解决「Población」标签无法隐藏的问题

试试这几个思路:

  • 先右键检查「Población」标签,确认它的for属性是不是真的是shipping_city——有些电商框架会给字段ID加额外前缀或后缀,实际可能是shipping_city_field这类值,选对属性值才能生效。
  • 提升CSS选择器的优先级,比如用页面容器+标签选择器组合,必要时可加!important(优先用具体选择器,万不得已再用此方法):
    .woocommerce-MyAccount-content label[for="shipping_city"] {
      display: none !important;
    }
    
  • 要是标签和输入框在同一个容器里,直接隐藏整个容器更省心,比如:
    .shipping_city_field {
      display: none;
    }
    
  • 实在不行用JS兜底,直接找到元素强制隐藏:
    document.querySelector('label[for="shipping_city"]')?.style.display = 'none';
    

内容的提问来源于stack exchange,提问作者Jose Pariona

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 14:57:03