Skip to content

Instantly share code, notes, and snippets.

@nomyfan
Created August 28, 2022 05:19
Show Gist options
  • Save nomyfan/62c8ca632fbb4ecbbf549473af4cc604 to your computer and use it in GitHub Desktop.
Save nomyfan/62c8ca632fbb4ecbbf549473af4cc604 to your computer and use it in GitHub Desktop.
Color tinting - wrapper solution
.box {
width: 300px;
height: 250px;
background-color: cornflowerblue;
transition: 0.5s background-color;
background-size: cover;
background-position: center;
}
.box:hover {
background-color: transparent;
}
.box > img {
object-fit: cover;
height: 100%;
width: 100%;
mix-blend-mode: luminosity;
}
import "./App.css";
import React from "react";
import image from "./philip-myrtorp-WqD_gO_xFgg-unsplash.jpg";
function App() {
return (
<div className="box">
<img src={image} />
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment