If you have used twitter, you may have noticed that when the input box gets the focus, its border will be blue-colored, and the transition attribute is used here, this makes the luminous effect have a smooth transition. This tutorial describes how to use the box-shadow attribute to achieve this effect.
The CSS code is as follows:
- Input {
- Transition: all 0.30 s bytes-in-out;
- -Webkit-transition: all 0.30 s bytes-in-out;
- -Moz-transition: all 0.30 s bytes-in-out;
- Outline: none;
- }
The transition attribute is used to show the changes in the input box.
In addition, the outline attribute must be used to invalidate the default highlighting of safari and chrome.
The box-shadow attribute is used in blue to make it glow rather than shadow.
You can also use RGBA to control the transparency of the color.
The Code is as follows:
- Input: focus {
- Border: #35a5e5 1px solid;
- Box-shadow: 0 0 5px rgba (81,203,238, 1 );
- -WebKit-box-Shadow: 0 0 5px rgba (81,203,238, 1 );
- -Moz-box-Shadow: 0 0 5px rgba (81,203,238, 1 );
- }
You can also use the border-radius attribute to achieve the rounded corner effect.
The complete CSS code is as follows:
- Input {
- Transition: All 0.30 s bytes-in-out;
- -WebKit-transition: All 0.30 s bytes-in-out;
- -Moz-transition: All 0.30 s bytes-in-out;
- Border: #35a5e5 1px solid;
- Border-radius: 4px;
- Outline: none;
- }
- Input: Focus {
- Box-Shadow: 0 0 5px rgba (81,203,238, 1 );
- -WebKit-box-Shadow: 0 0 5px rgba (81,203,238, 1 );
- -Moz-box-Shadow: 0 0 5px rgba (81,203,238, 1 );
- }
Link: http://htmltips.info/css-for-intermediaries/box-shadow-css-glow-effect/