Css: The luminous effect of box-shadow

Source: Internet
Author: User

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:

  1. Input {
  2. Transition: all 0.30 s bytes-in-out;
  3. -Webkit-transition: all 0.30 s bytes-in-out;
  4. -Moz-transition: all 0.30 s bytes-in-out;
  5. Outline: none;
  6. }

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:

  1. Input: focus {
  2. Border: #35a5e5 1px solid;
  3. Box-shadow: 0 0 5px rgba (81,203,238, 1 );
  4. -WebKit-box-Shadow: 0 0 5px rgba (81,203,238, 1 );
  5. -Moz-box-Shadow: 0 0 5px rgba (81,203,238, 1 );
  6. }

You can also use the border-radius attribute to achieve the rounded corner effect.

The complete CSS code is as follows:

  1. Input {
  2. Transition: All 0.30 s bytes-in-out;
  3. -WebKit-transition: All 0.30 s bytes-in-out;
  4. -Moz-transition: All 0.30 s bytes-in-out;
  5. Border: #35a5e5 1px solid;
  6. Border-radius: 4px;
  7. Outline: none;
  8. }
  9. Input: Focus {
  10. Box-Shadow: 0 0 5px rgba (81,203,238, 1 );
  11. -WebKit-box-Shadow: 0 0 5px rgba (81,203,238, 1 );
  12. -Moz-box-Shadow: 0 0 5px rgba (81,203,238, 1 );
  13. }

Link: http://htmltips.info/css-for-intermediaries/box-shadow-css-glow-effect/

Related Article

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.