以D之名;
有人說學好程序和英語好不好沒關系,我不爭辯,我特么默默地給你們介紹單詞;
transform? ;
發音 英[tr?ns'f??m; trɑ?ns-; -nz-]? 美[tr?ns'f?rm]? ;
漢語發音:(英)船絲'form (美)船四'four;
谷歌翻譯:轉變;有道翻譯:變形,改變;
動詞;
在CSS中它是一個屬性名,和單詞釋義一樣,變化轉變變形就是他的功能。屬性值里有這些- 旋轉:rotate;扭曲:skew;縮放:scale;移動:translate;矩陣變形:matrix;
旋轉:我們全局定義一個div容器盒子和一個div背景盒子以及一個實現的旋轉盒子;旋轉45度;
transform:rotate(45deg);
style
.bg-box{margin:50px auto;background:#fff;padding:75px;width:200px;box-shadow:0 3px5px#ddd;color:#555;}
.box{width:100px;height:100px;margin:auto;background:#ddd;cursor:pointer;box-shadow:0 0 5px#cccinset;}
.fill{width:100px;height:100px;position:relative;background:#03A9F4;opacity:0.5;box-shadow:0 0 5px#ccc;transform:rotate(45deg);}
html
<div class='bg-box'><div class='box'><div class='fill'></div></div></div>
效果截圖
實戰中的用途:實現一個小三角折線效果
原理,將一個div渲染兩條相鄰邊框,背景色:白;相對定位到這個位置;z-index比直線高,旋轉四十五度。代碼實在太繁瑣,就不上傳了,如果需要請聯系我。