.icon {
background: #888;
padding: 15px;
border-radius: 8px;
width: 44px;
height: 44px;
line-height: 44px;
text-align: center;
position: relative;
font-size: 32px;
&:hover .tooltip {
transition-delay: 3s;
width: auto;
height: auto;
clip: initial;
opacity: 1;
visibility: visible;
}
}
.tooltip {
position: absolute;
font-size: 16px;
width: 1px;
height: 1px;
padding: 0;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
background: black;
color: white;
line-height: normal;
top: 50%;
transform: translateY(-50%);
left: 90%;
padding: 3px 8px;
border-radius: 4px;
display: inline-block;
opacity: 0;
visibility: hidden;
transition: 0.2s;
&::before {
content: "";
right: 100%;
top: 50%;
transform: translateY(-50%);
position: absolute;
z-index: 1;
width: 0;
height: 0;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid transparent;
border-right: 5px solid black;
}
}
body {
height: 100vh;
margin: 0;
display: grid;
place-items: center;
}
View Compiled
import React from "https://cdn.skypack.dev/[email protected]";
import ReactDOM from "https://cdn.skypack.dev/[email protected]";
const App = () => {
return (
<div className="icon">
🤙
<span className="tooltip">Hang Loose</span>
</div>
);
};
ReactDOM.render(<App />, document.body);
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.