css - 字体大小不适用于 Opera 和 Chrome,但适用于 Firefox,虽然其他参数有效

标签 css google-chrome font-size opera

字体大小不适用于 Opera 和 Chrome,但适用于 Firefox。适用于边框、边距、动画、大小、字体系列,但不适用于字体大小。

我在嵌套跨度中有一个复杂的 ul-li 导航。我无法在内部设置字体大小 <a> .我还没有在其他部分/元素上设置字体,除了 html - 16px .我尝试了 rem 和 px 单位,但在 Opera 和 Chrome 中都不起作用。有没有一种特殊的方法可以为深层嵌套元素设置字体大小?为什么其他规则有效?

<div> <span>..12 spans... <span> 
   <a class='a.aBtn' ><span class='navDecr' ></span></a>
   ...other 12 <a> tags ...
   <ul> <li></li> ...12 li ... </ul> 
 </span> ... 12 closing spans </div>

//the same error a.aBtn span.navDescr {}

a span.navDescr { 
    font : 2rem, "Open Sans", sans-serif !important; //this is stroked through 
    text-align: right;
    text-align-last:left;
    font-weight:normal; 
    font-variant: normal;
    font-style:normal;
    line-height : 1.5; //will be multiplied with font_size
    font-stretch: normal;
    font-size-adjust:1;
}

如果我尝试将字体放在 li 上项儿,也行不通。适用于边框、边距、动画、大小、字体系列,但不适用于字体大小。

最佳答案

如果你想改变字体的大小,你应该使用font-size,如果你想改变字体的大小,你应该使用font-family来改变它

改变自

<a class='a.aBtn' ><span class='navDecr' >Test</span></a>

a span.navDescr { 
    font : 2rem, "Open Sans", sans-serif !important; //this is stroked through 
    text-align: right;
    text-align-last:left;
    font-weight:normal; 
    font-variant: normal;
    font-style:normal;
    line-height : 1.5; //will be multiplied with font_size
    font-stretch: normal;
    font-size-adjust:1;
}

<a class='aBtn' ><span class='navDecr' >Test</span></a>

.aBtn span { 
    font-size : 2rem; 
    font-family: "Open Sans", sans-serif !important; //this is stroked through
    text-align: right;
    text-align-last:left;
    font-weight:normal; 
    font-variant: normal;
    font-style:normal;
    line-height : 1.5; //will be multiplied with font_size
    font-stretch: normal;
    font-size-adjust:1;
}

它应该工作

关于css - 字体大小不适用于 Opera 和 Chrome,但适用于 Firefox,虽然其他参数有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45976527/

相关文章:

google-chrome - 在页面调整大小之前,Chrome 不会显示 HTML5 视频

ios - 如何使用 iOS Google Chrome 将二维码扫描到输入字段中?

itext - 使用 FontSelector 时更改字体颜色和大小

html - 具有自定义边框的 CSS 表格

html - 名片图像对齐

javascript - getElementsByClassName 和 …ByTagName, <path> 和 <svg>, 使用 onclick =""改变样式

javascript - 未捕获的类型错误 : Cannot call method 'substr' of undefined (Chrome/IE)

javascript - 文本自动字体大小

css - vw 实体中的字体大小 - 可调范围?

html - 使用 CSS 或 HTML 如何消除网站的边距?