18910140161

html-如何向标题CSS添加部分边框?-堆栈溢出

顺晟科技

2022-10-19 12:19:56

179

在CSS中可以使用这样的边框吗?

CSS边框


顺晟科技:

对伪类可能有一种更聪明的方法。但是这里有一个简单的解决方案,它为每个“边框”使用几个定位div。

.container { 
  position: relative; 
  z-index: 2;
  width: 400px;
  height: 100px;
}

.box { 
  position: absolute;
  width: 100%;
  height: 100%;
  background: white;
}

.box.border {
  z-index: -1;
  width: 33%;
  height: 100%;      
}

.box.left {
  background: yellow;
  left: -10px;
  bottom: -10px;
}

.box.right {
  background: blue;
  right: -10px;
  top: -10px;
}
  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航