使用方法:1、em表示相對於目前物件內文字的字體大小;2、rem表示相對於根元素的字體大小;3、ch表示數字0的大小;4、vh表示百分比視口的高度;5、vw表示百分比視口的寬度;6、ex表示當前字體的小寫x字母的高度或1/2的1em。
本教學操作環境:windows10系統、CSS3&&HTML5版、Dell G3電腦。
css3新增長度單位的使用方法是什麼
css3新增長度單位有:
em:相對於目前物件內文字的字體大小。相對於父節點的字體大小
rem:相對於根元素的字體大小。應用場景:以文字內容決定佈局的。
vh和vv:1vh等於1/100的視窗高度①,1vw等於1/100的視窗寬度。
vmin和vmax:關於視窗高度和寬度的最小值或最大值,vmin等於1/100的視口寬高中的最小值。應用場景:讓一個元素始終在螢幕中可見。
ch:數字0的寬度
ex:目前字體的小寫x字母的的高度或1/2的1em②。應用場景:上實上標和下標
ch -- 字元0(零)的寬度
rem -- 根元素(html元素)的font- size
什麼意思呢?
例如,根元素html的字體大小是100px,那麼,根元素下面的元素所設定的rem,都是 1rem = 100px。
rem的初始值是16px,也就是說在沒有設定根節點的font-size時候,1rem = 16px
切記,是相對於根元素html,如果設定body,則不會起作用
謹記:vw和vh只相對於瀏覽器視覺區域,即window.innerHeight,window.innerWidth
vw -- 瀏覽器視覺區域,1vw 等於瀏覽器可視區域寬度的1%
vh -- 瀏覽器可視區域, 1vh 等於瀏覽器可視區域高度的1%
vmin -- vw和vh中較小的那個
vmax -- vw和vh中較大的那個
例如瀏覽器寬/高設定為1000px/600px
那麼,
2vmin = 600*2/100 = 12px 2vmax = 1000*2/100 = 20px
(學習影片分享:css影片教學)
以上是css3新增長度單位的使用方法是什麼的詳細內容。更多資訊請關注PHP中文網其他相關文章!

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)

html5isnotinerysecure,butitsfeaturescanleadtosecurityrisksifmissusedorimproperlyimplempled.1)usethesand andboxattributeIniframestoconoconoconoContoContoContoContoContoconToconToconToconToconToconTedContDedContentContentPrenerabilnerabilityLikeClickLickLickLickjAckJackJacking.2)

HTML5aimedtoenhancewebdevelopmentbyintroducingsemanticelements,nativemultimediasupport,improvedformelements,andofflinecapabilities,contrastingwiththelimitationsofHTML4andXHTML.1)Itintroducedsemantictagslike,,,improvingstructureandSEO.2)Nativeaudioand

使用ID選擇器在CSS中並非固有地不好,但應謹慎使用。 1)ID選擇器適用於唯一元素或JavaScript鉤子。 2)對於一般樣式,應使用類選擇器,因為它們更靈活和可維護。通過平衡ID和類的使用,可以實現更robust和efficient的CSS架構。

html5'sgoalsin2024focusonrefinement和optimization,notNewFeatures.1)增強performanceandeffipedroptimizedRendering.2)inviveAccessibilitywithRefinedwithRefinedTributesAndEllements.3)explityconcerns,尤其是withercercern.4.4)

html5aimedtotoimprovewebdevelopmentInfourKeyAreas:1)多中心供應,2)語義結構,3)formcapabilities.1)offlineandstorageoptions.1)html5intoryements html5introctosements introdements and toctosements and toctosements,簡化了inifyingmediaembedingmediabbeddingingandenhangingusexperience.2)newsements.2)


熱AI工具

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

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

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

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

熱門文章

熱工具

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

Atom編輯器mac版下載
最受歡迎的的開源編輯器

記事本++7.3.1
好用且免費的程式碼編輯器