如何将边框图像放在div中

时间:2015-02-28 17:27:41

标签: html css border border-image

使用border-image CSS属性时,边框位于div之外。有没有办法将边框图像放在div

border-width: 50px;
border-image: url(Border.png) 50 repeat;

1 个答案:

答案 0 :(得分:1)

Codepen link

这是你的意思吗?

<强> HTML

<div>
 <span>

 </span>
</div>

<强> CSS

div {
  border: 1px solid black;
  width: 200px;
  height: 200px;
}

span {
  box-sizing: border-box;
  display: block;
  width: 200px;
  height: 200px;
  border-width: 50px;
  border-image: url(https://www.castlejackpot.com/wp-content/uploads/dynamik-gen/theme/images/home-horizontal-border.png) 50 repeat;
}