CSS-用偽類製作小箭頭(輪播圖的左右切換btn)

來源:互聯網
上載者:User

標籤:size   form   div   項目   com   第一個   normal   src   不同   

先上學習地址:http://www.htmleaf.com/Demo/201610234136.html

作者對輪播圖左右按鈕的處理方法一改往常,不是簡單地用btn.prev+btn.next的圖片代替,而是用純css製作。

第一個是left按鈕,即prev:

.vmc-arrow-left:after {    content: "\e079";}

第二個是right按鈕的,也就是next下一張的按鈕:

.vmc-arrow-right:after {    content: "\e080";}

最後是二者共同的樣式代碼:

.vmc-arrow-left:after, .vmc-arrow-right:after {    content: ‘‘;    display: inline-block;    font-family: ‘Glyphicons Halflings‘;    font-style: normal;    font-weight: 400;    line-height: 1;    -webkit-font-smoothing: antialiased;    font-size: 50px;    line-height: 50px;    color: white;    -webkit-font-smoothing: antialiased;    -moz-osx-font-smoothing: grayscale;    text-shadow: 2px 2px #000;}

首先,我覺得核心代碼就是偽類中添加的那兩個content內容,其次是共同樣式中的font-family的作用,如果不使用這個字型,會變成一個“口”。

其餘,都是樣式了,可以自訂的。

注意到一點是到了共同地區還是要有空內容先放在那裡的。

還是同一個網站,不同項目中,看到了font檔案夾中有icomoon的字型:

,

好奇查了一下,是一種web表徵圖字型,這樣就能解釋之前那個案例中,font-family的重要性的原因了。是那種字就是表徵圖字,而content載入的序號應該就是字型檔中對應的那種表徵圖字型。如下是一個小房子的表徵圖代碼:

.icon-htmleaf-home-outline:before {    content: "\e5000";}.htmleaf-icon:before {    margin: 0 5px;    text-transform: none;    font-weight: normal;    font-style: normal;    font-variant: normal;    font-family: ‘icomoon‘;    line-height: 1;    speak: none;    -webkit-font-smoothing: antialiased;}

 

CSS-用偽類製作小箭頭(輪播圖的左右切換btn)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.