合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
### 给有背景的元素添加半透明边框,但不使其透过当前元素的背景,则按照一般写法即可border-color为半透明色 ``` <style> div{ width: 100px; height: 100px; background-color: red; border: 10px solid rgba(255,255,255,0.5); } <style> <div></div> ``` ### 给有背景的元素添加半透明边框,想让半透明边框透过当前元素的背景,则添加background-clip: padding-box,该属性的默认值为border-box ``` <style> div{ width: 100px; height: 100px; background-color: red; border: 10px solid rgba(255,255,255,0.5); background: padding-box; } <style> <div></div> ```