大网数据广告活动
网站运营与故障问答

Structured data. Img. Width

· 52CE 我爱测

With structured data and img width and height, Google says "number required". Does it mean that Google only accepts the numbers in pixels? https://developers.google.com/search/docs/data-types/articles <div itemprop="image" itemsc…

问题原文

原帖链接 · Nrc · CC BY-SA 3.0

With structured data and img width and height, Google says "number required". Does it mean that Google only accepts the numbers in pixels?
https://developers.google.com/search/docs/data-types/articles

  <div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
    <img src="https://google.com/thumbnail1.jpg"/>
    <meta itemprop="url" content="https://google.com/thumbnail1.jpg">
    <meta itemprop="width" content="800">
    <meta itemprop="height" content="800">
  </div>

But nowadays almost all img need to be responsive. So the img CSS is:

img {
  width: 100%;
  height: auto;
}

and the structured data:

<meta itemprop="width" content="100%">
<meta itemprop="height" content="auto">

In structured data, the values of the width and height, how should it be? Can I use 100% and auto?

已采纳解答

原帖链接 · unor · CC BY-SA 3.0

Schema.org’s height/width properties are not for stating in which dimension the image should be displayed, but which dimension the image file has.

Knowing the image’s height/width, consumers (like Google Search) can then decide if to do something (and what to do) with the image. They will use their own CSS if they display the image.

In the case of Google Search, they want to see pixel values, e.g., for their Article rich result:

The height of the image, in pixels.

The width of the image, in pixels.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-09-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。