小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

css3 漸變邊框如何實(shí)現(xiàn)圓角效果

 頭號(hào)碼甲 2022-11-21 發(fā)布于北京

常規(guī)的 border-image 屬性如果直接使用 border-radius 會(huì)無(wú)效,關(guān)于如何實(shí)現(xiàn)漸變邊框圓角,網(wǎng)上流傳著大概這么幾種辦法:

  1. 漸變背景方式(僅適用于純底色背景)
  2. 借助 after 偽類(僅適用于純底色背景)
  3. 借助 css3 中的 mask 遮罩蒙版 加 after 偽類實(shí)現(xiàn)(僅適用于任何背景,但需要考慮瀏覽器兼容性)

本文僅介紹第三中方法:

源碼如下:

<style>
.border-radius-4 {
  position: relative;
  z-index: 1;
  width: 80px;
  height: 80px;
  text-align: center;
  padding: 10px;
  box-sizing: border-box;
}
.border-radius-4:after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(to bottom right, rgba(98, 54, 255, 0.3), rgba(252, 53, 100, 0.3));
  /* 徑向漸變中的 30px 計(jì)算方法為 (寬度 / 2 - 邊框大小),此處為 80px / 2 - 10px */
  mask-image: radial-gradient(transparent 0 30px, #000 30px);
  -webkit-mask-image: radial-gradient(transparent 0 30px, #000 30px);
}
</style>
<div class="border-radius-4">內(nèi)容</div>

效果參考地址

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多