transform是css3的新增屬性,用來設定元素的形狀改變,實現元素的2D或3D轉換,可以配合屬性值(轉換函數)來對將元素進行旋轉rotate、扭曲skew、縮放scale、行動translate以及矩陣變形matrix。
本教學操作環境:windows7系統、CSS3&&HTML5版、Dell G3電腦。
Transform字面上就是變形,改變的意思,是css3的新增屬性,用來設定元素的形狀改變,實現元素的2D或3D轉換。
在CSS3中transform主要包括以下幾種:旋轉rotate、扭曲skew、縮放scale和移動translate以及矩陣變形matrix。
rotate 旋轉
透過指定角度對元素進行旋轉度數為正順時針旋轉,如果設定的值為正數表示順時針旋轉,如果設定的值為負數,則表示逆時針旋轉。
例:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <style> body{ background-color: #000; } .box{ width: 100px; height: 100px; border: 1px solid #fff; position: relative; top: 100px; left: 100px; } .box1{ width: 100px; height: 100px; background-color: red; transform:rotate(30deg); } </style> <body> <div> <div></div> </div> </body> </html>
效果:
#scale 縮放
-
#scale 有三種情況: -
使元素水平方向和垂直方向同時縮放scale(x,y)
scaleX(x)元素僅水平方向縮放(X軸縮放)
- 元素僅垂直方向縮放(Y軸縮放)
<pre class='brush:php;toolbar:false;'>.box{ transfrom:scale(2,2) } .box{ transfrom:scaleX(2) } .box{ transfrom:scaleY(2) }</pre>
效果圖:-
移動translate分為三種情況:#translate 移動
-
水平方向和垂直方向同時移動(也就是X軸和Y軸同時移動);translate(x,y)
translateX(x)
僅水平方向移動(X軸移動);translateY(Y)僅垂直方向移動(Y軸移動)
translate(x,y)
.box{ transfrom:translate(100px,20px); }
# #transform:translateX().box{
transform:translateX(100px);
}
.box{ transform:translateY(100px); }
skew 扭曲skew也分為三種情況
skew(x,y)
使元素在水平和垂直方向同時扭曲(X軸和Y軸同時按一定的角度值進行扭曲變形);
skewX(x)
僅使元素在水平方向扭曲變形(X軸扭曲變形);
skewY(y)僅使元素在垂直方向扭曲變形(Y軸扭曲變形)
.box{ transform:skew(20deg,20deg); } .box{ transform:skewX(20deg); } .box{ transform:skewY(20deg); }####transform-origin 改變元素基點###### ###transform-origin(X ,Y)###:用來設定元素的運動的基點(參考點)。預設點是元素的中心點。其中X和Y的值可以是百分值、em、px,其中X也可以是字元參數值left、center、right;Y和X一樣除了百分值外還可以設定字元值top、center、bottom# #####(學習影片分享:###css影片教學###、###web前端入門教學###)###
以上是transform是css3新增的屬性嗎的詳細內容。更多資訊請關注PHP中文網其他相關文章!

使用類選擇器和ID選擇器取決於具體用例:1)類選擇器適用於多元素、可重用樣式,2)ID選擇器適用於唯一元素、特定樣式。類選擇器更靈活,ID選擇器處理速度更快但可能影響代碼維護性。

keykeygoalsandmotivationsbehindhtml5weretoenhancesemantstructure,Improvemultimediasupport,andensureBetterperformanceandCompatibalityAcroscaroscaroscaroscarossdecrossdecrossdecrossdecrossdecrossdecrossdecrossdevices,drivendybytheneedtoAddresshtml4'slimitationsand limitiTations and limittations andmeetmeetModerntructAndmmoderntructss.1)

IDSareNiqueAndusedForsingLelement,andleclassEsareSareSarereableFormultIllets.1)useIdIdSforuniqueElementsLikeAspeCificheader.2)useclassesforconsistentSistentSistentStyAcroSsmultipleLementslike.3)becautiouswithspecificitifieCificityAsiseSesses.4)

html5aimstoenhancewebaccctible,互動性和效率。 1)ITSupportsMultimediawithOutPlugins,Simplifyinginguserexperience.2)Semanticmarkmarksmarkupimprovissupimprovessupstructureandacccessessible.3)增強bacegencementingIncrassubility.4)

html5isnotparticulllydifficulttousebutrequirequireSustingingItsFeatures.1)smanticelementslike like ,,,和iMproveructure,andimprovucture,可讀性,seo和acctibility.2)多中性倍增量,且可讀性

No,youshouldn'tusemultipleIDsinthesameDOM.1)IDsmustbeuniqueperHTMLspecification,andusingduplicatescancauseinconsistentbrowserbehavior.2)Useclassesforstylingmultipleelements,attributeselectorsfortargetingbyattributes,anddescendantselectorsforstructure

html5aimstoenhancewebcapabilities,Makeitmoredynamic,互動,可及可訪問。 1)ITSupportsMultimediaElementsLikeAnd,消除innewingtheneedtheneedtheneedforplugins.2)SemanticeLelelemeneLementelementsimproveaCceccessibility inmproveAccessibility andcoderabilitile andcoderability.3)emply.3)lighteppoperable popperappoperable -poseive weepivewebappll

html5aimstoenhancewebdevelopmentanduserexperiencethroughsemantstructure,多媒體綜合和performanceimprovements.1)SemanticeLementLike like,和ImproVereAdiability and ImproVereAdabilityActibility.2)and tagsallowsemlessallowseamelesseamlessallowseamelesseamlesseamelesseamemelessmultimedimeDiaiaembediiaembedplugins.3)。 3)3)


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具