Html CSS 无效的属性值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32515519/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 18:12:32  来源:igfitidea点击:

CSS Invalid Property Value

htmlcss

提问by Skripsi Rico

I don't understand what's wrong with this? Google Chrome give this "CSS Invalid Property Value".

我不明白这有什么问题?谷歌浏览器给出了这个“CSS 无效的属性值”。

 <h2 class="grid-100" style="font: 'ralewaybold' 35px !important"><span>Portee</span> Goods</h2>

How to fix its?

如何修复它?

回答by Rohit Azad

your Font Shorthand property is not valid

您的字体速记属性无效

The font CSSproperty is either a shorthandproperty for setting font-style, font-variant, font-weight, font-size, line-heightand font-family, or a way to set the element'sfontto a system font, using specifickeywords.

字体CSS属性是一个速记设置属性font-stylefont-variantfont-weightfont-sizeline-heightfont-family,或方法来设置element'sfont到系统的字体,使用特定的关键字

Syntax

句法

 h2{
      font: font-style font-variant font-weight font-size/line-height font-family;
    }

In Use

正在使用

h2{
  font: italic small-caps normal 13px/150% Arial, Helvetica, sans-serif;
}

More about the shorthand font perperty

有关速记字体属性的更多信息

or used to this

或者习惯了

/* size | family */

/* 大小 | 家庭 */

font: 2em "Open Sans", sans-serif;

/* style | size | family */

/* 样式 | 尺寸 | 家庭 */

font: italic 2em "Open Sans", sans-serif;

/* style | variant | weight | size/line-height | family */

/* 样式 | 变体 | 重量 | 大小/行高| 家庭 */

font: italic small-caps bolder 16px/3 cursive;

/* The font used in system dialogs */

/* 系统对话框中使用的字体 */

font: message-box;

/* Global values */

/* 全局值 */

font: inherit;
font: initial;
font: unset;

回答by Lance

Swap the order. The order of the shorthand matters.

交换顺序。速记的顺序很重要。

<h2 class="grid-100" style="font: 35px 'ralewaybold' !important;">

回答by Lance

please try this one:

请试试这个:

please Add in it:font-size:35px !important;

请加入:font-size:35px !important;

<h2 class="grid-100" style="font: ralewaybold; font-size:35px !important;"><span>Portee</span> Goods</h2>

回答by John Louie Dela Cruz

Try removing 35px Importantand add it in font-size: 35px !important

尝试删除35px Important并添加它font-size: 35px !important

 <h2 class="grid-100" style="font: 'ralewaybold'; font-size: 35px !important"><span>Portee</span> Goods</h2>

回答by Amit singh

I think you missed the ;at the last..

我想你;最后错过了..

Your HTML

你的 HTML

<h2 class="grid-100" style="font: 'ralewaybold' 35px !important"><span>Portee</span> Goods</h2>

Updated HTML

更新的 HTML

<h2 class="grid-100" style="font: ralewaybold 35px !important;"><span>Portee</span> Goods</h2>