此数量字段生成的 html 输出应类似于:
<div class="quantity">
<label class="screen-reader-text" for="quantity_5c5856feb38cb">Quantity</label>
<input type="number" id="quantity_5c5856feb38cb" class="input-text qty text" step="1" min="1" max="35" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" aria-labelledby="Happy Ninja quantity">
</div>
所以<label>这个数量字段的标签使用screen-reader-text类来隐藏它,并使用以下 CSS 规则:
.screen-reader-text {
border: 0;
clip: rect(1px,1px,1px,1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
word-wrap: normal !important;
}
因此,您在某处进行了一些更改,这就是“数量”标签可见的原因。
编辑:
因此,您可以尝试将以下 CSS 规则添加到活动主题的 styles.css 文件中:
.single-product div.quantity > label {
display: block !important;
border: 0;
clip: rect(1px,1px,1px,1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px !important;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
word-wrap: normal !important;
}
它应该可以工作并隐藏单个产品页面上的“数量”标签......</p>