I have a simple CSS transition which increases the size of an element on hover. I would like to do the same but on focus, because the UI will be controlled through keyboard only. How can I do that? If I change :hover
to :focus
it does not work.
.card {
height: 200px;
width: 140px;
/* margin: 20px;*/
overflow: hidden;
transition: box-shadow 0.15s ease-out, transform 0.25s ease;
perspective: 600px;
border-radius: 5px;
}
.card:hover {
transform: scale(1.1);
box-shadow: none;
}
.card.hover--ending {
transition: box-shadow 0.5s ease;
}
<a href="/hello">
<article class="card">
<image type="image" src="https://icdn6.digitaltrends.com/image/google_1998-316x95.jpg" class="card__image posterImage focusable" />
</article>
</a>