【问题标题】:CSS - wordpress how to change the drop down element's font styleCSS - wordpress 如何更改下拉元素的字体样式
【发布时间】:2022-01-19 01:39:00
【问题描述】:

我正在尝试更改所有下拉列表中元素的字体。我想保留下拉列表标题的字体,但更改其中元素的字体。我在 wordpress 中使用礼物,所以我从 google devtool 获取了类代码,但我尝试编写 css 。我无法更改 html 代码,因为是预设。

<select id="pa_mat" class="" 
name="attribute_pa_mat" 
data-attribute_name="attribute_pa_mat" 
data-show_option_none="yes">
<option value="">Elige una opción</option>
<option value="foam" class="attached enabled">FOAM</option>
<option value="pvc" class="attached enabled">PVC</option></select>

css

option.attached enabled{
            font-family: Montserrat;
    font-weight: 700;
}

我正在尝试按照附图做一些事情。

例子

提前感谢大家

【问题讨论】:

    标签: html css wordpress woocommerce frontend


    【解决方案1】:

    您需要链接 CSS 选择器,例如:

    option.attached.enabled {
        font-family: Montserrat;
        font-weight: 700;
    }
    

    https://jsfiddle.net/39gd2mtq/

    您当前拥有的 (option.attached enabled) 正在寻找 option.attached 内名为 enabled 的子元素。

    【讨论】:

      猜你喜欢
      • 2019-07-23
      • 1970-01-01
      • 2013-11-24
      • 1970-01-01
      • 2021-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-09
      相关资源
      最近更新 更多