你的css规则不起作用,因为它是一个select
标签,你不能pseudo elements
在select
标签上使用css!!!如果您想了解有关此主题的更多信息,可以在以下页面上阅读:
伪元素和 SELECT 标签
和
<select> 和 :after 在 WebKit 中的 CSS 问题
现在,为了让 css 规则按照您想要的方式工作,您需要使用 css 定位不同的 html 元素!
.woocommerce p#billing_state_field::after{
content: "If you need medication mailed outside of NC or SC, or you are not a client, please call" !important;
font-size: 14px;
color: red;
padding: 5px;
}
这应该有效,但如果没有,那么我将使用以下方法作为alternative way
:
add_filter('woocommerce_checkout_fields', 'custom_checkout_notice', 20);
function custom_checkout_notice($fields){
$fields['billing']['custom_notice'] = array(
'label' => 'If you need medication mailed outside of NC or SC, or you are not a client, please call',
'priority' => 65 # you could change this number to move the notice up and down the list!
);
return $fields;
}
上面的代码片段将生成一个新的文本字段。一种使其按您想要的方式工作的方法,您可以执行以下操作:
add_filter('woocommerce_checkout_fields', 'custom_checkout_notice', 20);
function custom_checkout_notice($fields){
$fields['billing']['custom_notice'] = array(
'type' => 'text',
'label' => '',
'placeholder' => 'If you need medication mailed outside of NC or SC, or you are not a client, please call',
'priority' => 65 # you could change this number to move the notice up and down the list!
);
return $fields;
}
然后将其添加到您的活动主题或活动子主题的样式表中!
input#custom_notice{
border: none !important;
outline: none !important;
}