如何向webp图像添加样式

问题描述 投票:-1回答:1

我的代码看起来像

<picture>
  <source type="image/webp" srcset="img/photo.webp">
  <source type="image/jpg" srcset="img/photo.jpg">
  <img src="img/photo.jpg" alt="">
</picture >

我想在此图片中添加类,以便可以使用边界半径。我该怎么办?

html css webp
1个回答
0
投票

将类别放在<picture>标签上

<picture class="classname">
  <source type="image/webp" srcset="img/photo.webp">
  <source type="image/jpg" srcset="img/photo.jpg">
  <img src="img/photo.jpg" alt="" >
</picture>

像这样的css中的目标

.classname img{
    styles here
}
© www.soinside.com 2019 - 2024. All rights reserved.