Contact Us | +1 888 239-0733 (Toll free US/CA) Mon-Fri: 7:30am to 4:30pm (PST)

CSS 'border-image' Property Explained

Est. Reading: 2 minutes
Posted: April 5, 2024

The CSS 'border-image' property is a shorthand for specifying an image instead of the standard border style. This property combines several border-image properties into one, including setting the image source, slice, width, outset, and repeat the behavior. It enables the creation of intricate and visually appealing border designs that can enhance the aesthetic of a web page or component.

CSS 'border-image' Property Examples

See the Pen CSS 'border-image' Property by Webzstore (@webzstore) on CodePen.

The 'border-image' property offers a powerful and flexible way to enhance the visual design of elements with custom borders, allowing for creative expression beyond traditional CSS borders.

Browser Support For 'border-image' Property

FirefoxSafariChromeMicrosoft EdgeOpera
15.0
3.5 -moz-
6.0
3.1 -webkit-
16.0
4.0 -webkit-
11.015.0
11.0 -o-

CSS Syntax of the 'border-image' Property

border-image: source slice / width / outset repeat | initial | inherit;

Usage of the 'border-image' Property

Use 'border-image' instead of a solid border style when applying a graphical border to an element. This can be particularly useful for creating decorative borders incorporating brand colors, patterns, or themes. The property provides a flexible way to add visual interest and design detail to elements without adding additional markup or relying on external graphics.

Property Values of the 'border-image' Property

  • Source: Specifies the path to the image to be used as the border.
  • Slice: Defines how the image is divided into regions. The values determine the inward offsets from the image's top, right, bottom, and left edges, effectively slicing the image into nine parts: four corners, four edges, and the middle.
  • Width: This setting sets the width of the border image. If not specified, it defaults to the size of the border.
  • Outset: Determines how far the border image extends beyond the border box.
  • Repeat: Controls how the border image is repeated. Values include stretch, repeat, round, and space.
  • Initial: Resets all properties of 'border-image' to their initial values.
  • Inherit: Inherits the 'border-image' properties from the parent element.

Ryan Parker

Ryan has been a standout in digital marketing since 2010. He's the go-to person for getting businesses noticed online, with over 300 projects under his belt—these range from helping local business owners to big online stores. As the Head of Digital Marketing at his company, Ryan knows all the tricks to make companies shine on the internet. He's excellent at using the latest tech and smart strategies to get results. Ryan is all about making businesses grow and reach more people online.

chevron-down