How to use CSS3 to implement the color gradient glow effect of input box

Source: Internet
Author: User
This article mainly describes how to use CSS3 to achieve the input box color gradient glow effect, has a certain reference value, now share to everyone, the need for friends can refer to

CSS3 have been introduced for a long time, although the major mainstream browser for its compatibility is not very good, especially ie ... But by adding-moz--webkit-such prefixes can get better results under Chrome and Firefox, or the transition effect of transition implementation

Click the color gradient for the bounding box, which is not purely a Box-shadow property, it glows like a homogeneous glow around it, and it also contains a slow glow transition effect.

You must have some basic knowledge of CSS3 before you continue to study. Doing all this requires you to understand CSS3 's shadow and RGBA, transition attributes, otherwise you won't understand.

1. Create a glowing border text box effect

<input type= "text" class= "Sdw"/>

And then we're going to make this input component glow around when it's in focus (click), blue, and I just need to add a piece of CSS code:

Sdw:focus{transition:border linear. 2s,box-shadow linear. 5s;-moz-transition:border linear. 2s,-moz-box-shadow Linear .5s;-webkit-transition:border linear. 2s,-webkit-box-shadow linear. 5s;outline:none;border-color:rgba (93,149,242,. box-shadow:0); 0 8px Rgba (93,149,242,.105);-moz-box-shadow:0 0 8px Rgba (93,149,242,.5);-webkit-box-shadow:0 0 8px Rgba (93,149,242,3);}

You can do it. The RGB color can be changed according to individual tastes.

2. Add a border glow effect to all input components globally

If you want all text input boxes in a Web page to appear this effect, just CSS global settings.

Add this sentence to your CSS file:

input[type=text]:focus,input[type=password]:focus,textarea:focus{}

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.