- 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 Masking - mask-border Property
The mask-border CSS property helps you in creating a mask along the edge of an element's border.
The CSS property mask-border is a shorthand property to different longhand properties, which are described in the lower section.
Possible values
The CSS property mask-border can list one of the following values:
<'mask-border-source'>: Determines the source image. Refer mask-border-source for details.
<'mask-border-slice'>: Specifies the dimensions required for slicing the source image into different regions. Maximum upto four values can be specified. Refer >mask-border-slice for details.
<'mask-border-width'>: Determines the width of the border mask. Maximum upto four values can be specified. Refer mask-border-width for details.
<'mask-border-outset'>: Determines the distance between the border mask and the element's outside edge. Maximum upto four values can be specified. Refer mask-border-outset for details.
<'mask-border-repeat'>: Specifies the way the edges of the source image are adjusted in order to fit the dimensions of the border mask. Maximum upto two values can be specified. Refer mask-border-repeat for details.
<'mask-border-mode'>: Determines whether the source image is to be treated as a luminance mask or alpha mask. Maximum upto four values can be specified. Refer mask-border-mode for details.
Applies to
All HTML elements. And in case of SVG, it applies to the container element excluding the <defs> element and all graphics elements
Syntax
mask-border = <'mask-border-source'> || <'mask-border-slice'> [ / <'mask-border-width'>? [ / <'mask-border-outset'> ]? ]? || <'mask-border-repeat'> || <'mask-border-mode'>
CSS mask-border - Basic Example
The following example demonstrates the use of the CSS property mask-border, where an image is passed as the mask source image and other longhand property values are passed:
<html> <head> <style> .with-mask { -webkit-mask-box-image: url("images/logo.png") 20 fill / /* slice */ 10px / /* width */ 2px /* outset */ round; /* repeat */ mask-border: url("images/logo.png") 20 fill / /* slice */ 10px / /* width */ 2px /* outset */ round; /* repeat */ } </style> </head> <body> <h1>The mask-border Property</h1> <h3>With mask-border</h3> <div class="with-mask"> <img src="images/border.png" alt="mask border image" width="300" height="200"> </div> <h3>Without mask-border</h3> <img src="images/border.png" alt="mask border image" width="300" height="200"> </body> </html>
CSS mask-border - Related Properties
The table given below lists the various longhand properties that are passed to the mask-border property:
Property | Description |
---|---|
mask-border-mode | Determines whether the source image is to be treated as a luminance mask or alpha mask. |
mask-border-outset | Determines the distance between the border mask and the element's outside edge. |
mask-border-repeat | Specifies the way the edges of the source image are adjusted in order to fit the dimensions of the border mask. |
mask-border-slice | Specifies the dimensions required for slicing the source image into different regions. |
mask-border-source | Determines the source image. |
mask-border-width | Determines the width of the border mask. |
To Continue Learning Please Login
Login with Google