這篇文章將為大家詳細(xì)講解有關(guān)css中clip-path屬性如何使用,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
clip-path的使用
polygon
值為多個(gè)坐標(biāo)點(diǎn)組成,坐標(biāo)第一個(gè)值是x方向,第二個(gè)值是y方向。
左上角為原點(diǎn),右下角是(100%,100%)的點(diǎn)。</p>
body { background-color: #000; } .fa { border: 1px solid #fff; color: yellowgreen; padding: 10px; margin: 10px; } .fa>p { width: 110px; height: 110px; background-color: yellowgreen; margin: 20px auto; } .polygon1 { clip-path: polygon(50% 0px, 100% 100%, 0px 100%) } .polygon2 { clip-path: polygon(0px 50%, 50% 0, 100% 50%, 50% 100%) } .polygon3 { clip-path: polygon(0% 60%, 20% 0%, 60% 0%, 40% 60%) }
<div class="fa"> <p>polygon</p> <p>值為多個(gè)坐標(biāo)點(diǎn)組成,坐標(biāo)第一個(gè)值是x方向,第二個(gè)值是y方向。</p> <p>左上角為原點(diǎn),右下角是(100%,100%)的點(diǎn)。</p> <div class="polygon1"></div> <div class="polygon2"></div> <div class="polygon3"></div> </div>
circle
值為一個(gè)坐標(biāo)點(diǎn)和半徑組成。
左上角為原點(diǎn),右下角是(100%,100%)的點(diǎn)。
定義半徑的時(shí)候可以用at關(guān)鍵字來定義坐標(biāo)。
body { background-color: #000; } .fa { border: 1px solid #fff; color: yellowgreen; padding: 10px; margin: 10px; } .fa>p { width: 110px; height: 110px; background-color: yellowgreen; margin: 20px auto; } .circle1 { clip-path: circle(50% at 50% 50%) } .circle2 { clip-path: circle(70% at 50% 50%) } .circle3 { clip-path: circle(30% at 10% 10%) }
<div class="fa"> <p>circle</p> <p>值為一個(gè)坐標(biāo)點(diǎn)和半徑組成。</p> <p>左上角為原點(diǎn),右下角是(100%,100%)的點(diǎn)。</p> <p>定義半徑的時(shí)候可以用at關(guān)鍵字來定義坐標(biāo)。</p> <div class="circle1"></div> <div class="circle2"></div> <div class="circle3"></div> </div>
ellipse
值為橢圓的x軸半徑,y軸半徑,定位橢圓的坐標(biāo)三部分組成。
左上角為原點(diǎn),右下角是(100%,100%)的點(diǎn)。
at關(guān)鍵字將半徑和坐標(biāo)分開。
body { background-color: #000; } .fa { border: 1px solid #fff; color: yellowgreen; padding: 10px; margin: 10px; } .fa>p { width: 110px; height: 110px; background-color: yellowgreen; margin: 20px auto; } .ellipse1 { clip-path: ellipse(30% 20% at 50% 50%) } .ellipse2 { clip-path: ellipse(20% 30% at 50% 50%) } .ellipse3 { clip-path: ellipse(60% 10% at 10% 10%) }
<div class="fa"> <p>ellipse</p> <p>值為橢圓的x軸半徑,y軸半徑,定位橢圓的坐標(biāo)三部分組成。</p> <p>左上角為原點(diǎn),右下角是(100%,100%)的點(diǎn)。</p> <p>at關(guān)鍵字將半徑和坐標(biāo)分開</p> <div class="ellipse1"></div> <div class="ellipse2"></div> <div class="ellipse3"></div> </div>
inset
值為(上 右 下 左 round 左上角radius 右上角radius 右下角radius 左下角radius)
round前面的數(shù)值,表示的是距離,如果第一個(gè)值為25%,則表示圖像在上面從25%開始繪制。
body { background-color: #000; } .fa { border: 1px solid #fff; color: yellowgreen; padding: 10px; margin: 10px; } .fa>p { width: 110px; height: 110px; background-color: yellowgreen; margin: 20px auto; } .inset1 { clip-path: inset(25% 0% 25% 0% round 0% 25% 0% 25%) } .inset2 { clip-path: inset(0% 25% 25% 0% round 25% 25% 25% 0%) } .inset3 { clip-path: inset(25% 25% 0% 0% round 0% 25% 0% 25%) }
<div class="fa"> <p>inset</p> <p>值為(上 右 下 左 round 左上角radius 右上角radius 右下角radius 左下角radius)</p> <p>round前面的數(shù)值,表示的是距離,如果第一個(gè)值為25%,則表示圖像在上面從25%開始繪制</p> <div class="inset1"></div> <div class="inset2"></div> <div class="inset3"></div> </div>
關(guān)于css中clip-path屬性如何使用就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。
本文題目:css中clip-path屬性如何使用-創(chuàng)新互聯(lián)
網(wǎng)站路徑:http://www.rwnh.cn/article40/hdieo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、云服務(wù)器、外貿(mào)網(wǎng)站建設(shè)、品牌網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計(jì)、域名注冊(cè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容