Rotate Icon on Hover
CSS
Medium
3 views
Problem Description
Rotate a small arrow icon when you hover the button.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use transform rotate and transition.
Official Solution
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>meetcode</title>
<style>
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; border: 1px solid #ddd; background: #fff; }
.icon { display: inline-block; transition: transform 180ms ease; }
.btn:hover .icon { transform: rotate(90deg); }
</style>
</head>
<body>
<button class='btn' type='button'>
Next <span class='icon'>›</span>
</button>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!