问题原文
原帖链接 · 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
