css3 2d轉換

來源:互聯網
上載者:User

標籤:otto   transform   sla   預設   tom   body   latex   ott   htm   

<!DOCTYPE html>
<html>
<head>
<title>2D轉換</title>
<style type="text/css">
.box{
width: 400px;
height: 400px;
margin: 100px auto;
position: relative;
}
img:nth-child(1){
width: 400px;
height: 400px;
}
img:nth-child(2){
width: 150px;
height: 200px;
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
margin: auto;
/*translate平移 單位px 也可以使用百分比
translate()唯寫一個值的時候代表的是x的位移 兩個參數代表是x,y的位移
*/
/*transform: translateY(10%) translateX(10%);*/
/*transform: translate(10px,100px);*/
/* scale 單位是數值 縮放 scaleX()代表在x方向上縮放 scaleY()代表在y軸上縮放
scale()只有一個值的時候代表xy方向上都進行縮放
不能為負值 負值時取的是絕對值*/
/*transform: scale(2);*/
/*skew 單位是deg角度
skew()只有一個參數的時候 代表在x軸上傾斜 兩個參數的時候代表分別在xy軸上傾斜*/
/*transform: skew(10deg,20deg);*/
/*rotate旋轉單位是角度 rotateX代表繞著x軸順時針旋轉
rotateY代表繞著y軸順時針旋轉
rotate()一個參數的時候代表在Z軸上旋轉 不能多個值*/
transform: rotate(20deg);
/*transform-origin可以來決定旋轉的位置 預設的是50% 50%
也可以設定成關鍵詞如left top center center等等*/
transform-origin: center center;
}
</style>
</head>
<body>
<div class="box">
<img src="img/bg-grid.jpg">
<img src="img/dameizi.jpeg">
</div>
</body>
</html>

css3 2d轉換

聯繫我們

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