| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | <title>Border Transition Test</title> |
| 7 | <style> |
| 8 | body { |
| 9 | font-family: system-ui, -apple-system, sans-serif; |
| 10 | padding: 40px; |
| 11 | max-width: 600px; |
| 12 | margin: 0 auto; |
| 13 | } |
| 14 | |
| 15 | #toggle-button { |
| 16 | padding: 12px 24px; |
| 17 | font-size: 16px; |
| 18 | background: #3b82f6; |
| 19 | color: white; |
| 20 | border: 2px solid transparent; |
| 21 | border-radius: 6px; |
| 22 | cursor: pointer; |
| 23 | } |
| 24 | |
| 25 | #toggle-button:hover { |
| 26 | background: #2563eb; |
| 27 | } |
| 28 | |
| 29 | .red-border { |
| 30 | transition: border 200ms ease-in-out; |
| 31 | border: 8px solid red; |
| 32 | } |
| 33 | </style> |
| 34 | </head> |
| 35 | <body> |
| 36 | <h1>Border Transition Test</h1> |
| 37 | <p>Click the button to toggle a thick red border with a 200ms transition.</p> |
| 38 | |
| 39 | <button id="toggle-button">Toggle Border</button> |
| 40 | |
| 41 | <script> |
| 42 | const button = document.getElementById('toggle-button'); |
| 43 | |
| 44 | button.addEventListener('click', () => { |
| 45 | button.insertAdjacentHTML("afterend", "<div>asdfasdf</div>") |
| 46 | setTimeout(()=> { |
| 47 | button.nextElementSibling.classList.toggle('red-border'); |
| 48 | }, 0) |
| 49 | }); |
| 50 | </script> |
| 51 | </body> |
| 52 | </html> |