'RMarkdown CSS for single image, building slides

I have the following code in Rmarkdown where I want to round the image tom.jpg. I am making a slide deck.

img {
  height: 250px;
  width: 250px;
  border-radius: 50%;
  object-fit: cover;
}
```{r, echo=FALSE}
knitr::include_graphics("img/tom.jpg")

I only want to round the image tom.jpg, but every image i create after calling the css gets rounded. How can i just round the image tom.jpg?



Solution 1:[1]

To add a specific class out.extra='class="border shadowed"' Source

CSS:

.myimg {
  height: 250px;
  width: 250px;
  border-radius: 50%;
  object-fit: cover;
}

RMarkdown:

```
{r img-with-knitr, echo=FALSE, fig.align='center', out.extra='class="myimg"'}
knitr::include_graphics("images/my-image.png")
```

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 savageGoat