Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the border-image attribute in css

Shulou Source: shulou.com Published: 2022-06-01 12:14:00 10月22日 Update

This article mainly shows you "how to use the border-image attribute in css", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use the border-image attribute in css" this article.

CSS3border-image attribute

Purpose: use pictures to create borders

Description: compound attributes. Sets or retrieves the border style of the object to be filled with an image. You can set the values of the border-image-source,border-image-slice,border-image-width,border-image-outset and border-image-repeat properties at once.

Syntax:

Border-image:sourceslicewidthoutsetrepeat | initial | inherit

Parameters:

Border-image-source: lets you specify the location of the image you want to use to draw the border.

Border-image-slice: the image boundary is offset inward.

Border-image-width: the width of the image boundary.

Border-image-outset: lets you specify how much border-image-area is drawn outside the border.

Border-image-repeat: sets whether the image boundary should repeat (repeat), stretch (stretch), or round (round).

Example of using css3border-image property

Div

{

Border:15pxsolidtransparent

Width:300px

Padding:10px20px

}

# round

{

-moz-border-image:url (https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030round;/*OldFirefox*/

-webkit-border-image:url (https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030round;/*SafariandChrome*/

-o-border-image:url (https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030round;/*Opera*/

Border-image:url (https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030round;

}

# stretch

{

-moz-border-image:url (https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030stretch;/*OldFirefox*/

-webkit-border-image:url (https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030stretch;/*SafariandChrome*/

-o-border-image:url (https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030stretch;/*Opera*/

Border-image:url (https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030stretch;

}

Here, the picture is covered with the entire frame.

Here, the picture is stretched to fill the area.

This is the picture we used:

Note: the border-image attribute is not supported by InternetExplorer.

The border-image property specifies the picture to use as a border.

The above is all the content of the article "how to use the border-image attribute in css". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Properties borders images pictures content articles boundaries learning help disposable location function parameters width objects easy to understand more organization styles comments Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Shulou Technology Redmi NVidia OPPO Reno