Modern Input Design with Glowing Border on Focus
One possible design for a modern input with a glowing border when active could be:
- Start with a clean, minimalist input field design, like a rectangular or rounded rectangle shape with a white or light gray background and a thin border or no border at all.
- Add a subtle drop shadow or inner shadow effect to create depth and highlight the input field.
- Use a bold, bright color for the border or outline of the input field, such as neon green, electric blue, or hot pink. This will create a strong contrast with the background and draw the user's attention to the input.
- When the user clicks or taps on the input field, animate the border or outline to start glowing or pulsing with a softer, lighter version of the same color. You can use CSS transitions or JavaScript animations to achieve this effect.
- To enhance the effect, you can also add a subtle ripple or wave animation to the background of the input field, as if the user's touch is creating a ripple effect on the surface. This can be achieved with a CSS pseudo-element and some keyframe animations.
- Finally, make sure to provide clear and concise instructions or labels for the input field, so the user knows what to enter and what format to use. You can use placeholder text, helper text, or inline validation to guide the user and prevent errors.
Here is an example code snippet for a glowing border input field:
<label for='username'>Username:</label>
<input type='text' id='username' name='username' placeholder='Enter your username'>
<style>
input {
background-color: #fff;
border: none;
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
font-size: 16px;
padding: 10px;
transition: border-color 0.2s ease-in-out;
}
input:focus {
border-color: #7eff00;
}
input:focus::before {
content: "";
position: absolute;
top: -2px;
left: -2px;
width: calc(100% + 4px);
height: calc(100% + 4px);
border-radius: 4px;
border: 2px solid #7eff00;
animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
0% {
opacity: 0.2;
box-shadow: 0 0 0 0 rgba(126,255,0,0.7);
}
50% {
opacity: 1;
box-shadow: 0 0 0 10px rgba(126,255,0,0);
}
100% {
opacity: 0.2;
box-shadow: 0 0 0 0 rgba(126,255,0,0);
}
}
</style>
This code will create an input field with a white background, no border, and a subtle shadow effect. When the user clicks on the input, the border will turn neon green and start pulsing with a softer green glow. The animation will continue infinitely until the user clicks outside of the input. You can customize the colors, timings, and other properties to fit your design needs.
原文地址: https://www.cveoy.top/t/topic/nnsr 著作权归作者所有。请勿转载和采集!