-2

my code looks like

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

I want to add class to this picture so I can use border-radius. how can I do that?

  • 2
    Does this answer your question? [How to add CSS class to the HTML5 picture element](https://stackoverflow.com/questions/28008293/how-to-add-css-class-to-the-html5-picture-element) – Libra Dec 18 '19 at 21:58

1 Answers1

1

Put the class on the <picture> tag

<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>

Target the <img> tag in the CSS like this

.classname img{
    styles here
}
Libra
  • 2,544
  • 1
  • 8
  • 24