CSS border-image-width Property

You are Here:

CSS border-image-width Property

CSS border-image-width property sets the width of an element's border image.

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ border: 15px solid transparent; padding: 15px; width: 250px; min-height: 60px; text-align: center; margin: 25px; border-image-source: url(car-left.png); border-image-repeat: repeat; } #point{ border-image-width: 30px; } #point1{ border-image-width: 50px; } </style> </head> <body> <h1>CSS border-image-width Property</h1> <h2>border-width: 30px;</h2> <div id="point"> border-image-width: 30px; </div> <h2>border-width: 50px;</h2> <div id="point1"> border-image-width: 50px; </div> </body> </html>

Syntax

Using CSS

element{ border-image-width: 50px; }

Using Javascript

object.style.borderImageWidth="50px";

Animatable

No, border-image-width property is not animatable. CSS Animatable Properties Reference.

Default Value

Default value for CSS border-image-width property is 1.

Property Value

The following table provides a list of values for CSS border-image-width property.

ValueExplanation
lengthAllows you to define the border-image-width in any CSS length unit.
NumberThe width of the border, specified as a multiple of the corresponding border-width. Must not be negative.
%Percentages are relative to the width of the border image area for horizontal offsets and the height of the border image area for vertical offsets. Must not be negative.
autohe width of the border is made equal to the intrinsic width or height (whichever is applicable) of the corresponding border-image-slice.

Using JavaScript

In the following example, we will demonstrate how to change the CSS border-image-width property of an element using JavaScript.

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ border: 15px solid transparent; padding: 15px; width: 200px; min-height: 60px; margin: 25px; text-align: center; border-image-source: url(car-left.png); border-image-repeat: repeat; border-image-width: 30px; } </style> </head> <body> <h1>CSS border-image-width Property</h1> <div> This is div container. </div> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("div")[0]; function myFunction(){ x.style.borderImageWidth = "50px"; } </script> </body> </html>

Reminder

Hi Developers, we almost covered 98.7% of CSS Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in CSS.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author