Agyan
adda
Run
Reset
Copy
CSS Tutorial › CSS Transitions › Hover transitions
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<style> .btn { background: #1f386b; color: white; border: none; padding: 12px 24px; border-radius: 6px; font-size: 16px; cursor: pointer; transition: background-color .3s ease, transform .3s ease; } .btn:hover { background: #e8590c; transform: translateY(-3px); } .grow { width: 100px; height: 40px; background: seagreen; margin-top: 16px; transition: width 1s ease-in-out; } .grow:hover { width: 300px; } </style> <button class="btn">Hover me</button> <div class="grow"></div>
Result