您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關(guān)css中clip裁剪怎么用的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。
clip 屬性是用來設(shè)置元素的形狀。用來剪裁絕對(duì)定位元素(absolute or fixed)。
clip有三種取值:auto |inherit|rect。inherit是繼承,ie不支持這個(gè)屬性, auto是默認(rèn) 前兩個(gè)基本屬于打醬油的,我們主要來說一下clip的rect屬性。
clip的rect屬性 : clip:rect(top,right,bottom,left)四個(gè)屬性值不可缺少;
這四個(gè)屬性值到底是如何計(jì)算的呢 先看下邊這張圖
rect的top,right,bottom,left是基于左上角來計(jì)算的
html:
<div id="demo"> <u class="c1"></u><u class="c2"></u> </div>
css:
#demo { position: relative; border: 1px solid #ccc; width:140px; height: 140px; padding-top: 20px; } #demo u { width: 128px;height: 128px; position: absolute; background: url(words.png) 0 -624px no-repeat;transition: all .5s ease-in-out 0s} #demo p { text-align: center; line-height: 120px; background: url(words.png) 400px -624px no-repeat} #demo .c1 { clip: rect(0,128px,0,64px);} #demo .c2 { clip:rect(128px,64px,128px,0px)} #demo:hover>.c1 {clip:rect(0px,128px,128px,64px)} #demo:hover>.c2 {clip:rect(0px,64px,128px,0)}
感謝各位的閱讀!關(guān)于“css中clip裁剪怎么用”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。