athene-70b-0725· unknown
from LMArena Human Preference 100K
write a html code with tailwindcss (use cdn) to create a neomorphic button.
- User
write a html code with tailwindcss (use cdn) to create a neomorphic button.
- Assistant
Here's an example of HTML code using Tailwind CSS (via CDN) to create a neomorphic button:
html<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Neomorphic Button with Tailwind CSS</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@3.2.4/dist/tailwind.min.css"> <style> /* Add a custom shadow utility to enhance the neomorphic effect */ .neomorphic-shadow { box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.2), -6px -6px 12px rgba(255, 255, 255, 0.7); } </style> </head> <body> <button class="neomorphic-shadow rounded-full px-6 py-3 bg-gray-200 hover:bg-gray-300 active:translate-y-1 active:shadow-none transition duration-300 ease-in-out"> Click me! </button> </body> </html>Explanation:
- We include Tailwind CSS via CDN in the
<head>section. - We define a custom CSS utility
.neomorphic-shadowto achieve the characteristic inner shadow and outer glow of neomorphic design. This utility combines twobox-shadowvalues: a dark outer shadow and a light inner glow. - The button element uses the following classes:
neomorphic-shadow: Applies our custom shadow utility.rounded-full: Gives the button a rounded shape.px-6 py-3: Adds horizontal and vertical padding.bg-gray-200: Sets the base background color.hover:bg-gray-300: Changes the background color on hover.active:translate-y-1 active:shadow-none: On active state (i.e., when pressed), translates the button down by 1px and removes the shadow to create a pressed effect.transition duration-300 ease-in-out: Smoothly animates the hover and active states over 300ms with an ease-in-out timing function.
This code produces a beautiful, interactive neomorphic button with a subtle 3D-like effect, leveraging Tailwind's concise class-based syntax and our custom shadow utility. Feel free to adjust the styles and values to fit your design preferences!
- We include Tailwind CSS via CDN in the
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.