
- CSS - Home
- CSS - Roadmap
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Types
- CSS - Measurement Units
- CSS - Selectors
- 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 - Cascading
- CSS - Universal Selectors
- CSS - ID Selectors
- CSS - Group Selectors
- CSS - Class Selectors
- CSS - Child Selectors
- CSS - Element Selectors
- CSS - Descendant Selectors
- CSS - General Sibling Selectors
- CSS - Adjacent Sibling Selectors
- 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 Advanced Features
- 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 Interview Questions
- CSS Online Quiz
- CSS Online Test
- CSS Mock Test
- CSS - Quick Guide
- CSS - Cheatsheet
- CSS - Properties References
- CSS - Functions References
- CSS - Color References
- CSS - Web Browser References
- CSS - Web Safe Fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS - mask-clip Property
CSS mask-clip property controls how a mask is applied to an element. It determines which parts of the element are affected by the mask based on its size and positioning.
Syntax
mask-clip: border-box | content-box | padding-box | fill-box | stroke-box | view-box | no-clip | border | padding | content | text | initial | inherit;
Property Values
Value | Description |
---|---|
border-box | The mask is clipped to the outer edge of the element's border box. |
content-box | The mask is clipped to the outer edge of the element's content box. |
padding-box | The mask is clipped to the outer edge of the element's padding box. |
fill-box | The mask is clipped to the object bounding box, including the padding and border. |
stroke-box | The mask is clipped to the stroke (border-area) bounding box. |
view-box | The nearest SVG viewport serves as a reference box, aligning content at its origin with dimensions from the viewBox attribute. |
no-clip | No clipping occurs. |
border | It is same as border-box. |
padding | It is same as padding-box. |
content | It is same as content-box. |
text | It clips the mask to the text of the element. |
initial | It sets the property to its default value. |
inherit | It inherits the property from the parent element. |
Examples of CSS Mask Clip Property
The following examples explain the mask-clip property with different values.
Mask Clip Property with Content Box Value
To apply masks only to the content area of the element, excluding padding, border, and margin, we use the content-box value. The effect is visible strictly within the content area defined by width and height. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .mask-container { width: 100px; height: 100px; background-color: lightgreen; margin: 10px; border: 20px solid green; padding: 20px; -webkit-mask-image: url(/css/images/book.png); -webkit-mask-size: 100% 100%; -webkit-mask-clip: content-box; mask-image: url(/css/images/book.png); mask-size: 100% 100%; mask-clip: content-box; } </style> </head> <body> <h2> CSS mask-clip property </h2> <h4> clip-property: content-box </h4> <div class="mask-container"> TutorialsPoint offers diverse, comprehensive tech and programming tutorials for learners. </div> </body> </html>
Mask Clip Property with Padding Box Value
To apply masks within the padding area of the element, including padding but excluding the border, we use the padding-box value. The effect extends from the content area to the outer edge of the padding. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .mask-container { width: 100px; height: 100px; background-color: lightgreen; margin: 10px; border: 20px solid green; padding: 20px; -webkit-mask-image: url(/css/images/book.png); -webkit-mask-size: 100% 100%; -webkit-mask-clip: padding-box; mask-image: url(/css/images/book.png); mask-size: 100% 100%; mask-clip: padding-box; } </style> </head> <body> <h2> CSS mask-clip property </h2> <h4> clip-property: padding-box </h4> <div class="mask-container"> TutorialsPoint offers diverse, comprehensive tech and programming tutorials for learners. </div> </body> </html>
Mask Clip Property with Border Box Value
To apply masks to cover the entire area of the element, including the content, padding, and border, we use the border-box value. It does not extend into the margin area, affecting the element's full size as seen visually. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .mask-container { width: 100px; height: 100px; background-color: lightgreen; margin: 10px; border: 20px solid green; padding: 20px; -webkit-mask-image: url(/css/images/book.png); -webkit-mask-size: 100% 100%; -webkit-mask-clip: border-box; mask-image: url(/css/images/book.png); mask-size: 100% 100%; mask-clip: border-box; } </style> </head> <body> <h2> CSS mask-clip property </h2> <h4> clip-property: border-box </h4> <div class="mask-container"> TutorialsPoint offers diverse, comprehensive tech and programming tutorials for learners. </div> </body> </html>
Mask Clip Property with Fill Box Value
To apply masks within the bounds of the elements fill, relevant for SVG elements, we use the fill-box value. The mask covers the area that would be filled with color, excluding the stroke. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .mask-container { width: 100px; height: 100px; background-color: lightgreen; margin: 10px; border: 20px solid green; padding: 20px; -webkit-mask-image: url(/css/images/book.png); -webkit-mask-size: 100% 100%; -webkit-mask-clip: fill-box; mask-image: url(/css/images/book.png); mask-size: 100% 100%; mask-clip: fill-box; } </style> </head> <body> <h2> CSS mask-clip property </h2> <h4> clip-property: fill-box </h4> <div class="mask-container"> TutorialsPoint offers diverse, comprehensive tech and programming tutorials for learners. </div> </body> </html>
Mask Clip Property with Stroke Box Value
To apply masks to the area covered by the element's stroke, relevant for SVG elements, we use the stroke-box value. This includes the stroke width, aligning the mask to the outer bounds of the stroke. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .mask-container { width: 100px; height: 100px; background-color: lightgreen; margin: 10px; border: 20px solid green; padding: 20px; -webkit-mask-image: url(/css/images/book.png); -webkit-mask-size: 100% 100%; -webkit-mask-clip: stroke-box; mask-image: url(/css/images/book.png); mask-size: 100% 100%; mask-clip: stroke-box; } </style> </head> <body> <h2> CSS mask-clip property </h2> <h4> clip-property: stroke-box </h4> <div class="mask-container"> TutorialsPoint offers diverse, comprehensive tech and programming tutorials for learners. </div> </body> </html>
Mask Clip Property with View Box Value
To apply masks within the SVG's viewBox bounds, aligning with the SVG's coordinate system, we use the view-box value. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .mask-container { width: 100px; height: 100px; background-color: lightgreen; margin: 10px; border: 20px solid green; padding: 20px; -webkit-mask-image: url(/css/images/book.png); -webkit-mask-size: 100% 100%; -webkit-mask-clip: view-box; mask-image: url(/css/images/book.png); mask-size: 100% 100%; mask-clip: view-box; } </style> </head> <body> <h2> CSS mask-clip property </h2> <h4> clip-property: view-box </h4> <div class="mask-container"> TutorialsPoint offers diverse, comprehensive tech and programming tutorials for learners. </div> </body> </html>
Mask Clip Property with No Clip Value
To apply masks without any clipping to the elements box model, we use the no-clip value. The mask effect is not restricted by the boundaries of content, padding, border, or margin, making the mask extend beyond the elements standard box. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .mask-container { width: 100px; height: 100px; background-color: lightgreen; margin: 10px; border: 20px solid green; padding: 20px; -webkit-mask-image: url(/css/images/book.png); -webkit-mask-size: 100% 100%; -webkit-mask-clip: no-clip; mask-image: url(/css/images/book.png); mask-size: 100% 100%; mask-clip: no-clip; } </style> </head> <body> <h2> CSS mask-clip property </h2> <h4> clip-property: no-clip </h4> <div class="mask-container"> TutorialsPoint offers diverse, comprehensive tech and programming tutorials for learners. </div> </body> </html>
Supported Browsers
Property | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
mask-clip | 120 | 120 | 53 | 15.4 | 106 |