conditional border-radius

PHOTO EMBED

Fri Mar 11 2022 13:28:46 GMT+0000 (Coordinated Universal Time)

Saved by @Sebhart #css #sass

.feed-item {
  border-radius: max(0px, min(8px, ((100vw - 4px) - 100%) * 9999)) / 8px;
}
content_copyCOPY

…what the what? Why is this border-radius property trying to hack me and steal my credit card information with CSS? Joking aside, Ahmad then wrote a great post about what he calls conditional border-radius in CSS and describes what the code above does: it only adds a border-radius when the card is not taking up the full viewport width of the browser.

https://css-tricks.com/newsletter/272-jams/