Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css <;img/>;vs背景图像_Css_Html_Image_Semantics - Fatal编程技术网

Css <;img/>;vs背景图像

Css <;img/>;vs背景图像,css,html,image,semantics,Css,Html,Image,Semantics,我在stackoverflow上找到了,对此我有一个问题。我可以使用此代码来满足SEO和页面设计部分的要求吗 <figure> <img src="https://placehold.it/350x150" alt="something important"> <figcaption> something important </figcaption> </figure> *{ font-family: helveti

我在stackoverflow上找到了,对此我有一个问题。我可以使用此代码来满足SEO和页面设计部分的要求吗

<figure>
 <img src="https://placehold.it/350x150" alt="something important">
 <figcaption>
   something important
 </figcaption>
</figure>

*{
  font-family: helvetica;
}
figure {
 margin: 100px auto;
 position: relative;
 width: 500px;
 height: 100px;
 background-image: url(https://placehold.it/650x150);
 background-size: cover;
 background-position: center center;
}

img{
 display: none;
 }
figcaption{
  position: absolute;
 bottom: 0;
 width: 100%;
 background: maroon;
 color: WhiteSmoke;
 text-align: center;
 font:small-caption;
 font-style: italic;
}

重要的事
*{
字体系列:helvetica;
}
身材{
保证金:100像素自动;
位置:相对位置;
宽度:500px;
高度:100px;
背景图片:url(https://placehold.it/650x150);
背景尺寸:封面;
背景位置:中心;
}
img{
显示:无;
}
菲卡普顿{
位置:绝对位置;
底部:0;
宽度:100%;
背景:褐红色;
颜色:白烟;
文本对齐:居中;
字体:小标题;
字体:斜体;
}
我在stackoverflow上发现了这个,对此我有一个问题。我可以在CodePen上使用此代码来满足页面的SEO和设计部分吗

<figure>
 <img src="https://placehold.it/350x150" alt="something important">
 <figcaption>
   something important
 </figcaption>
</figure>

*{
  font-family: helvetica;
}
figure {
 margin: 100px auto;
 position: relative;
 width: 500px;
 height: 100px;
 background-image: url(https://placehold.it/650x150);
 background-size: cover;
 background-position: center center;
}

img{
 display: none;
 }
figcaption{
  position: absolute;
 bottom: 0;
 width: 100%;
 background: maroon;
 color: WhiteSmoke;
 text-align: center;
 font:small-caption;
 font-style: italic;
}
搜索引擎优化:是的,请检查并删除

只要你提供的图像适合你的内容,并有助于改善用户体验,你就会很好。确保提供有价值的alt属性文本,不要试图滥用系统


设计:看起来语义正确,我喜欢外观,虽然外观更主观。

“满足SEO”取决于页面上的内容。你没有提供任何背景:img或背景中有什么,以及你为什么使用其中一个或另一个或两者。这是一个出售艺术品的画廊。。。img是指他们出售的图片的缩略图,但这些JPEG不是在100px*100px上裁剪的,但有些是300px,有些是500px。。。我想要同样大小的,但不要把我所有的时间都花在裁剪上。。。我认为在背景图像上使用内联样式搜索蜘蛛并不关心页面的外观,它们只关心文本,包括
figcaption
标记和
alt
属性。我理解。。。。我问这个问题是因为我希望它能提供信息,可以搜索,并且看起来很好…@AmericanSlime谷歌现在可以理解图像,正如你所知。(好)今天的蜘蛛也关心图像。谢谢你的回答。。。这是非常有益的。。。设计只是一个例子。。。我只需要检查一下这个。。。我知道用css我不会改变html,但它的重要性。。。因此,如果具有alt属性的图像在那里是可接受的。。。