WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
×

CSS Reference

CSS Reference CSS Selectors CSS Functions CSS Reference Aural CSS Web Safe Fonts CSS Animatable CSS Units CSS PX-EM Converter CSS Colors CSS Color Values CSS3 Browser Support

CSS Properties

align-content align-items align-self all animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-shadow box-sizing caption-side clear clip color column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset cursor direction display empty-cells filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font @font-face font-family font-size font-size-adjust font-stretch font-style font-variant font-weight hanging-punctuation height justify-content @keyframes left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top max-height max-width @media min-height min-width nav-down nav-index nav-left nav-right nav-up opacity order outline outline-color outline-offset outline-style outline-width overflow overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page-break-after page-break-before page-break-inside perspective perspective-origin position quotes resize right tab-size table-layout text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-style text-indent text-justify text-overflow text-shadow text-transform top transform transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi vertical-align visibility white-space width word-break word-spacing word-wrap z-index



 

CSS3 filter Property


Example

Change the shade of all pictures to high contrast (100% gray):

img {
    - webkit-channel: grayscale(100%);/* Chrome, Safari, Musical drama */
    channel: grayscale(100%);
}

Mountain View
Original image
Mountain View
grayscale(100%)


Definition and Usage

The channel property characterizes special visualizations (like haze and immersion) to a component (regularly <img>).

Default value: none
Inherited: no
Animatable: yes.
Version: CSS3
JavaScript syntax: object.style.WebkitFilter="grayscale(100%)"

Browser Support

The numbers in the table indicate the main program form that completely bolsters the property.

Numbers pursued by - webkit-determine the main form that worked with a prefix.

Property
filter 18.0 - webkit- Not supported 35.0 6.0 - webkit- 15.0 - webkit-

CSS Syntax

channel: none | obscure() | splendor() | differentiate() | drop-shadow() | grayscale() | tone pivot() | modify() | murkiness() | immerse() | sepia() | url();

Tip: To utilize numerous channels, separate each channel with a space (See "More Examples" below).


Filter Functions

Note: The channels that utilization rate esteems (for example 75%), likewise acknowledge the incentive as decimal (for example 0.75).

Filter Description
none Default esteem. Determines no effects
blur(px) Applies a haze impact to the picture. A bigger esteem will make more haze.

If no esteem is determined, 0 is used.
brightness(%) Adjusts the splendor of the picture.

0% will make the picture totally black.
100% (1) is default and speaks to the first image.
Qualities over 100% will give more brilliant results.
contrast(%) Adjusts the difference of the image.

0% will make the picture totally black.
100% (1) is default and speaks to the first image.
Qualities over 100% will furnish results with less contrast.
drop-shadow(h-shadow v-shadow obscure spread color) Applies a drop shadow impact to the picture.

Possible values:
h-shadow - Required. Determines a pixel esteem for the even shadow. Negative qualities place the shadow to one side of the image.

v-shadow - Required. Determines a pixel esteem for the vertical shadow. Negative qualities place the shadow over the image.

blur - Discretionary. This is the third esteem, and should be in pixels. Includes a haze impact to the shadow. A bigger esteem will make more obscure (the shadow progresses toward becoming greater and lighter). Negative qualities are not permitted. On the off chance that no esteem is indicated, 0 is utilized (the shadow's edge is sharp).

spread - Optional. This is the fourth esteem, what's more, must be in pixels. Positive qualities will make the shadow extend and become greater, and negative qualities will make the shadow shrivel. If not indicated, it will be 0 (the shadow will be indistinguishable size from the component).
Note: Chrome, Safari and Opera, what's more, perhaps different programs, don't bolster this fourth length; it won't render in the event that added.

color - Optional. Adds a shading to the shadow. On the off chance that not determined, the shading relies upon the program (regularly black).

An case of making a red shadow, which is 8px enormous both on a level plane and vertically, with a haze impact of 10px:

filter: drop-shadow(8px 8px 10px red);

Tip: This channel is like the box-shadow property.
grayscale(%) Converts the picture to grayscale.

0% (0) is default and speaks to the first image.
100% will make the picture totally dim (utilized for high contrast images).

Note: Negative qualities are not allowed.
hue-rotate(deg) Applies a tint pivot on the picture. The esteem characterizes the quantity of degrees around the shading circle the picture tests will be balanced. 0deg is default, and speaks to the first image.

Note: Maximum esteem is 360deg.
invert(%) Inverts the examples in the picture.

0% (0) is default and speaks to the first image.
100% will make the picture totally inverted.

Note: Negative qualities are not allowed.
opacity(%) Sets the haziness level for the picture. The mistiness level depicts the straightforwardness level, where:

0% is totally transparent.
100% (1) is default and speaks to the first picture (no transparency).

Note: Negative qualities are not allowed.
Tip: This channel is like the opacity property.
saturate(%) Saturates the picture.

0% (0) will make the picture totally un-saturated.
100% is default and speaks to the first image.
Values over 100% gives super-immersed results.
sepia(%) Converts the picture to sepia.

0% (0) is default and speaks to the first picture.
100% will make the picture totally sepia.

Note: Negative qualities are not allowed.
url() The url() work takes the area of a XML document that determines an SVG channel, and may incorporate a stay to a particular channel component. Example:

filter: url(svg-url#element-id)
initial Sets this property to its default esteem.
inherit Inherits this property from its parent component.

Blur Example

Apply a haze impact to the image:

img {
    - webkit-channel: blur(5px);/* Chrome, Safari, Musical show */
    channel: blur(5px);
}

Mountain View
Original image
Mountain View
blur(5px)

Brightness Example

Adjust the splendor of the image:

img {
    - webkit-channel: brightness(200%);/* Chrome, Safari, Musical show */
    channel: brightness(200%);
}

Mountain View
Original image
Mountain View
brightness(200%)

Contrast Example

Adjust the difference of the image:

img {
    - webkit-channel: contrast(200%);/* Chrome, Safari, Musical show */
    channel: contrast(200%);
}

Mountain View
Original image
Mountain View
contrast(200%)

Drop Shadow Example

Apply a drop shadow impact to the image:

img {
    - webkit-channel: drop-shadow(8px 8px 10px red);/* Chrome, Safari, Musical show */
    channel: drop-shadow(8px 8px 10px red);
}

Mountain View
Original image
Mountain View
drop-shadow(8px 8px 10px red)

Grayscale Example

Convert the picture to grayscale:

img {
    - webkit-channel: grayscale(50%);/* Chrome, Safari, Musical show */
    channel: grayscale(50%);
}

Mountain View
Original image
Mountain View
grayscale(50%)

Hue Rotation Example

Apply a tint pivot on the image:

img {
    - webkit-channel: tint rotate(90deg);/* Chrome, Safari, Musical show */
    channel: tint rotate(90deg);
}

Mountain View
Original image
Mountain View
hue-rotate(90deg)

Invert Example

Invert the examples in the image:

img {
    - webkit-channel: invert(100%);/* Chrome, Safari, Musical show */
    channel: invert(100%);
}

Mountain View
Original image
Mountain View
invert(100%)

Opacity Example

Set the opacity level for the image:

img {
    -webkit-filter: opacity(30%); /* Chrome, Safari, Opera */
    filter: opacity(30%);
}

Mountain View
Original image
Mountain View
opacity(30%)

Saturate Example

Saturate the image:

img {
    -webkit-filter: saturate(800%); /* Chrome, Safari, Opera */
    filter: saturate(800%);
}

Mountain View
Original image
Mountain View
saturate(800%)

Sepia Example

Convert the image to sepia:

img {
    -webkit-filter: sepia(100%); /* Chrome, Safari, Opera */
    filter: sepia(100%);
}

Mountain View
Original image
Mountain View
sepia(100%)

Combining Filters / Multiple Filters

To use multiple filters, separate each filter with a space.

Note: Order is important (i.e. using grayscale() after sepia() will result in a completely gray image).

img {
    -webkit-filter: contrast(200%) brightness(150%);  /* Chrome, Safari, Opera */
    filter: contrast(200%) brightness(150%);
}

Mountain View
Original image
Mountain View
contrast(200%) brightness(150%)

All Filters

A demonstration of all filter functions:

.blur {
    -webkit-filter: blur(4px);
    filter: blur(4px);
}

.brightness {
    -webkit-filter: brightness(0.30);
    filter: brightness(0.30);
}

.contrast {
    -webkit-filter: contrast(180%);
    filter: contrast(180%);
}

.grayscale {
    -webkit-filter: grayscale(100%);
    filter: grayscale(100%);
}

.huerotate {
    -webkit-filter: hue-rotate(180deg);
    filter: hue-rotate(180deg);
}

.invert {
    -webkit-filter: invert(100%);
    filter: invert(100%);
}

.opacity {
    -webkit-filter: opacity(50%);
    filter: opacity(50%);
}

.saturate {
    -webkit-filter: saturate(7);
    filter: saturate(7);
}

.sepia {
    -webkit-filter: sepia(100%);
    filter: sepia(100%);
}

.shadow {
    -webkit-filter: drop-shadow(8px 8px 10px green);
    filter: drop-shadow(8px 8px 10px green);
}