I have an element whose width I would like to animate when its contents change. He has width: auto, and that never changes. I saw this trick , but to go between two values and one set. I don’t manipulate values at all, only the content, and I would like the element size to change with the animation. Is this possible in CSS?
Here is a simplified version of my code:
.myspan {
background-color: #ddd;
}
.myspan:hover::after {
content: "\00a0\f12a";
font-family: Ionicons;
font-size: 80%;
}
<link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet"/>
<html>
<body>
<span class="myspan">Hello!</span>
</body>
</html>
Run codeI would like the resizable to appear when the user hangs over an element.
source
share