CSS3 Filter Properties in detail

Source: Internet
Author: User
This article mainly introduces the detailed information about the powerful filter (filter) attribute in the CSS3, and the friends you need can refer to the following

Bloggers recently in the process of doing the site found a very powerful CSS3 property, is the Filter property, like the P-graph friends to see the name should know what the artifact is. Of course, the effect of this property must not be compared with PS, but the use of good words can save a lot of space, a picture made of two pictures of the effect.

1. Definition  

Filter, which is literally a filter, the official Definition Filter property defines the visual effects of elements (usually ), such as Blur and saturation; for a chestnut:


<style>    img{/* Grayscale 100%*/        -webkit-filter:grayscale (100%);    } </style>

    

See this effect, Bo Friends are all beginning to start interested in filter?

2. Grammar

Filter:none | Blur () | Brightness () | Contrast () | Drop-shadow () | Grayscale () | Hue-rotate () | Invert () | Opacity () | Saturate () | Sepia () | URL ();

As you can see, the properties have a lot of optional values, what do they mean?

    1. Grayscale Grayscale

    2. Sepia Brown (kind of retro old photo feeling)

    3. Saturation of saturate

    4. Hue-rotate Hue Rotation

    5. Invert inverse color

    6. Opacity transparency

    7. Brightness brightness

    8. Contrast contrast ratio

    9. Blur Blur

    10. Drop-shadow Shadow

Give me a chestnut:

Here, adjust with sepia.



Example Picture:

3. Example 

Below, for some of the values of the Filter property to do an example, other fun things need to explore together with friends, what fun to share with me yo

(1) hue-rotate (color rotation)

Look at the effect of the picture bar, the specific use of the effect depends on everyone to explore:


     <style>          . img{              -webkit-filter:hue-rotate (330deg);          }      </style>  

(2) blur (fuzzy)

Blur (Blur effect, Unit px)


     <style>          . img{            -webkit-filter:blur (1px);          }      </style>  <body>     </body>

Example Picture:

(3) Invert anti-color

Invert anti-color will be the picture into a negative feeling, more useless, look at the code:


<style>        . img{            -webkit-filter:invert (100%);        }    </style><body> </body>

Example Picture:

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.