- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Selectors
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Border Block
- CSS - Border Inline
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursor
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS - Inline Block
- CSS - Dropdowns
- CSS - Visibility
- CSS - Overflow
- CSS - Clearfix
- CSS - Float
- CSS - Arrows
- CSS - Resize
- CSS - Quotes
- CSS - Order
- CSS - Position
- CSS - Hyphens
- CSS - Hover
- CSS - Display
- CSS - Focus
- CSS - Zoom
- CSS - Translate
- CSS - Height
- CSS - Hyphenate Character
- CSS - Width
- CSS - Opacity
- CSS - Z-Index
- CSS - Bottom
- CSS - Navbar
- CSS - Overlay
- CSS - Forms
- CSS - Align
- CSS - Icons
- CSS - Image Gallery
- CSS - Comments
- CSS - Loaders
- CSS - Attr Selectors
- CSS - Combinators
- CSS - Root
- CSS - Box Model
- CSS - Counters
- CSS - Clip
- CSS - Writing Mode
- CSS - Unicode-bidi
- CSS - min-content
- CSS - All
- CSS - Inset
- CSS - Isolation
- CSS - Overscroll
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - Pointer Events
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - Max Block Size
- CSS - Min Block Size
- CSS - Mix Blend Mode
- CSS - Max Inline Size
- CSS - Min Inline Size
- CSS - Offset
- CSS - Accent Color
- CSS - User Select
- CSS Advanced
- CSS - Grid
- CSS - Grid Layout
- CSS - Flexbox
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Paged Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS - Image Sprites
- CSS - Important
- CSS - Data Types
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS - Rounded Corner
- CSS - Border Images
- CSS - Multi Background
- CSS - Color
- CSS - Gradients
- CSS - Box Shadow
- CSS - Box Decoration Break
- CSS - Caret Color
- CSS - Text Shadow
- CSS - Text
- CSS - 2d transform
- CSS - 3d transform
- CSS - Transition
- CSS - Animation
- CSS - Multi columns
- CSS - Box Sizing
- CSS - Tooltips
- CSS - Buttons
- CSS - Pagination
- CSS - Variables
- CSS - Media Queries
- CSS - Functions
- CSS - Math Functions
- CSS - Masking
- CSS - Shapes
- CSS - Style Images
- CSS - Specificity
- CSS - Custom Properties
- CSS Responsive
- CSS RWD - Introduction
- CSS RWD - Viewport
- CSS RWD - Grid View
- CSS RWD - Media Queries
- CSS RWD - Images
- CSS RWD - Videos
- CSS RWD - Frameworks
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS Data Type - <filter-function>
The CSS data type <filter-function> signifies a graphical effect, which changes the appearance of an input image. This data type is used in the filter and backdrop-filter properties of CSS.
Possible values
The data type <filter-function> is defined using one of the following filter functions, where each function needs an argument to be passed. In case the argument is invalid, no filter will be applied.
blur(): Image is blurred.
brightness(): Image is made brighter or darker.
contrast(): Image's contrast is increased or decreased.
drop-shadow(): A drop shadow is applied behind the image.
grayscale(): Image converted to grayscale.
hue-rotate(): Hue of the image is changed.
invert(): Colors of the image is inverted.
opacity(): Image is made transparent.
saturate(): Input image is super-saturated or desaturated.
sepia(): Image is converted to sepia.
Syntax
<filter-function> = <blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>
CSS <filter-function> - Blurring an image
The following example demonstrates the use of blur() filter function to blur an image:
<html> <head> <style> .blur-image { filter: blur(8px); } .box { background: url(images/orange-flower.jpg) no-repeat center; width: 200px; height: 200px; } </style> </head> <body> <h2><filter-function> - blur()</h2> <p>No blur</p> <div class="box"></div> <p>Blurred</p> <div class="box blur-image"></div> </body> </html>
CSS <filter-function> - Brightening an image
The following example demonstrates the use of brightness() filter function to increase or decrease the brightness of an image:
<html> <head> <style> .bright-image-inc{ filter: brightness(180%); } .bright-image-dec { filter: brightness(50%); } .box { background: url(images/orange-flower.jpg) no-repeat center; width: 200px; height: 200px; } </style> </head> <body> <h2><filter-function> - brightness()</h2> <p>Normal</p> <div class="box"></div> <p>Brightness Increased</p> <div class="box bright-image-inc"></div> <p>Brightness Decreased</p> <div class="box bright-image-dec"></div> </body> </html>
CSS <filter-function> - Changing the contrast of an image
The following example demonstrates the use of contrast() filter function to change the contrast of an image:
<html> <head> <style> .contrast-image-inc{ filter: contrast(250%); } .contrast-image-dec { filter: contrast(25%); } .box { background: url(images/red-flower.jpg) no-repeat center; width: 200px; height: 200px; } </style> </head> <body> <h2><filter-function> - contrast()</h2> <p>Normal</p> <div class="box"></div> <p>Contrast Increased</p> <div class="box contrast-image-inc"></div> <p>Contrast Decreased</p> <div class="box contrast-image-dec"></div> </body> </html>
For more examples of filter functions, refer the filter page.
To Continue Learning Please Login
Login with Google