CSS3給頁面打標籤

來源:互聯網
上載者:User

標籤:style   blog   http   color   io   使用   java   ar   for   

我們經常會在頁面的左上方或者右上方看到類似的標籤,比如頁面的連結(最常使用)等,下面我們就實現一個簡單的標籤

 

 實現步驟是先做一個水平長條,使用CSS3的transform來實現旋轉,如果是在左上方的話就逆時針旋轉45度,右上方順時針旋轉45度。

代碼:

 1 <!DOCTYPE html> 2 <html> 3 <head> 4     <title></title> 5     <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 6     <style> 7         .demo{ 8             display: inline-block; 9             height: 20px; 10             width: 200px; 11             background: #f00;12             text-align: center;13             margin-top: 40px;14             margin-left: -45px;15             text-decoration: none;16             color:#fff;17             -webkit-transform: rotate(-45deg);18             -moz-transform: rotate(-45deg);19             -ms-transform: rotate(-45deg);20             -o-transform: rotate(-45deg);21             transform: rotate(-45deg);22         }23     </style>24 </head>25 <body>26     <a class="demo" href="javasript:;">Follow me</a>27 </body>28 </html>

 

transform:
  1. 瀏覽器支援

    Internet Explorer 10、Firefox、Opera 支援 transform 屬性。

    Internet Explorer 9 支援替代的 -ms-transform 屬性(僅適用於 2D 轉換)。

    Safari 和 Chrome 支援替代的 -webkit-transform 屬性(3D 和 2D 轉換)。

    Opera 只支援 2D 轉換。

  2. 定義和用法
    transform 屬性向元素應用 2D 或 3D 轉換。該屬性允許我們對元素進行旋轉、縮放、移動或傾斜。
    預設值:none
    繼承性:no
  3. 文法
    transform: none|transform-functions;
    值 描述
    none 定義不進行轉換。
    matrix(n,n,n,n,n,n) 定義 2D 轉換,使用六個值的矩陣。
    matrix3d(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n) 定義 3D 轉換,使用 16 個值的 4x4 矩陣。
    translate(x,y) 定義 2D 轉換。
    translate3d(x,y,z) 定義 3D 轉換。
    translateX(x) 定義轉換,只是用 X 軸的值。
    translateY(y) 定義轉換,只是用 Y 軸的值。
    translateZ(z) 定義 3D 轉換,只是用 Z 軸的值。
    scale(x,y) 定義 2D 縮放轉換。
    scale3d(x,y,z) 定義 3D 縮放轉換。
    scaleX(x) 通過設定 X 軸的值來定義縮放轉換。
    scaleY(y) 通過設定 Y 軸的值來定義縮放轉換。
    scaleZ(z) 通過設定 Z 軸的值來定義 3D 縮放轉換。
    rotate(angle) 定義 2D 旋轉,在參數中規定角度。
    rotate3d(x,y,z,angle) 定義 3D 旋轉。
    rotateX(angle) 定義沿著 X 軸的 3D 旋轉。
    rotateY(angle) 定義沿著 Y 軸的 3D 旋轉。
    rotateZ(angle) 定義沿著 Z 軸的 3D 旋轉。
    skew(x-angle,y-angle) 定義沿著 X 和 Y 軸的 2D 傾斜轉換。
    skewX(angle) 定義沿著 X 軸的 2D 傾斜轉換。
    skewY(angle) 定義沿著 Y 軸的 2D 傾斜轉換。
    perspective(n) 為 3D 轉換元素定義透視視圖。

 

CSS3給頁面打標籤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.