Home > Web Front-end > Front-end Q&A > How to use css border-image-slice property

How to use css border-image-slice property

青灯夜游
Release: 2019-05-30 11:26:43
Original
2944 people have browsed it

css border-image-slice property is used to specify the inward offset of the image border (top, right, bottom, left). The image will be divided into nine areas: four corners, four sides and a middle area. Unless the fill keyword is used, the middle portion of the image is discarded.

How to use css border-image-slice property

How to use the css border-image-slice property?

The border-image-slice attribute specifies the inward offset of the image border.

Syntax:

border-image-slice: number|%|fill;
Copy after login

Attribute value:

● Number: Numeric value, representing the pixels in the image (if it is a raster image) or vector coordinates (in the case of a vector image).​

● %: Percentage value relative to the image size: the width of the image affects the horizontal offset, and the height affects the vertical offset.​

● Fill: Keep the middle part of the border image.

Note:

This attribute specifies the inward offset of the upper, right, lower, and left edges of the image. The image is divided into nine regions: four corners, four sides and a middle area. Unless the fill keyword is used, the middle portion of the image is discarded. If the fourth value/percentage is omitted, it is the same as the second value. If the third value is omitted, it is the same as the first value. If the second value is omitted, it is the same as the first value.

css border-image-slice property example

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style> 
div {
    border: 30px solid transparent;
    border-image: url(&#39;https://img.php.cn/upload/article/000/000/024/5c62637b1a4fe853.png&#39;);
    border-image-repeat: round;
    border-image-slice:30;
}
</style>
</head>
<body>
<div>
 DIV 使用图像边框
</div>
<p>使用的图片:</p>
<img src="https://img.php.cn/upload/article/000/000/024/5c62637b1a4fe853.png">
</body>
</html>
Copy after login

How to use css border-image-slice property

The above is the detailed content of How to use css border-image-slice property. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template