加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html – 选择字体大小

发布时间:2020-12-14 21:47:37 所属栏目:资源 来源:网络整理
导读:我已经建立了 this fiddle作为我正在做的一个例子。 我想做的工作在Firefox中工作正常。当您打开选择选项时,font-size为14px。 然而,在Google Chrome浏览器中,它会选择继承的字体大小为34px。 我最理想的是选择要选择的字体大小为14px。 这可以做吗 如果
我已经建立了 this fiddle作为我正在做的一个例子。

我想做的工作在Firefox中工作正常。当您打开选择选项时,font-size为14px。

然而,在Google Chrome浏览器中,它会选择继承的字体大小为34px。

我最理想的是选择要选择的字体大小为14px。

这可以做吗

如果需要,我愿意在jQuery中做任何相关的修复。

谢谢

下列代码……

我的CSS是:

.styled-select {
    overflow: hidden;
    height: 74px;
    float: left;
    width: 365px;
    margin-right: 10px;
    background: url(http://i50.tinypic.com/9ldb8j.png) no-repeat right center #5c5c5c;
}

.styled-select select {
    font-size: 34px;
    border-radius: 0;
    border: none;
    background: transparent;
    width: 380px;
    overflow: hidden;
    padding-top: 15px;
    height: 70px;
    text-indent: 10px;
    color: #ffffff;
    -webkit-appearance: none;
}

.styled-select option.service-small {
    font-size: 14px;
    padding: 5px;
    background: #5c5c5c;
}

HTML标记:

<div class="styled-select">
    <select class="service-area" name="service-area">
        <option selected="selected" class="service-small">Service area?</option>
        <option class="service-small">Volunteering</option>
        <option class="service-small">Partnership &amp; Support</option>
        <option class="service-small">Business Services</option>
    </select>
</div>

解决方法

一个解决方案可能是在 optgroup中包装选项:

HTML:

<optgroup>
  <option selected="selected" class="service-small">Service area?</option>
  <option class="service-small">Volunteering</option>
  <option class="service-small">Partnership &amp; Support</option>
  <option class="service-small">Business Services</option>
</optgroup>

CSS:

optgroup { font-size:14px; }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读