amazon.nova-pro-v1:0 LMArena Human Preference 140K
build a beautifully animated button
- User
build a beautifully animated button
- Assistant
Creating a beautifully animated button involves combining HTML, CSS, and possibly JavaScript to achieve the desired effect. Below is an example of a button with a hover animation using HTML and CSS.
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Animated Button</title> <link rel="stylesheet" href="styles.css"> </head> <body> <button class="animated-button">Click Me</button> </body> </html>CSS (styles.css)
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f0f0f0; font-family: Arial, sans-serif; } .animated-button { padding: 15px 30px; font-size: 18px; color: #fff; background-color: #007BFF; border: none; border-radius: 50px; cursor: pointer; transition: background-color 0.3s, transform 0.2s; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); outline: none; } .animated-button:hover { background-color: #0056b3; transform: translateY(-3px); } .animated-button:active { transform: translateY(0); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }Explanation
-
HTML Structure:
- A simple button element with the class
animated-button.
- A simple button element with the class
-
CSS Styling:
- The
bodyis styled to center the button both horizontally and vertically. - The
.animated-buttonclass styles the button with padding, font size, color, background color, border radius, and other properties to make it look appealing. - The
transitionproperty is used to animate the background color change and the transform property on hover. - On hover, the button’s background color darkens, and it slightly moves up using the
transform: translateY(-3px)property. - On active (click), the button returns to its original position with a subtle shadow change.
- The
This creates a smooth and visually pleasing animation for the button. You can further customize the colors, sizes, and animations to fit your design needs.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.