CSS3新增的动画帧非常绚丽,可以简单实现一些动画效果,目前除IE外各大主流浏览器都支持
本文演示三个:transform: scale3d(x, y, z)-缩放;、transform: translate3d(x, y, z)-位移;、transform:rotateX/Y(?deg)-旋转;
演示地址:http://wjf444128852.github.io/demo02/css3/index.html
@keyframes 动画名{}
@-处理兼容性-keyframes<br />animation: expand 0.6s ease-out infinite;[动画名 动画执行时间 动画速度 动画次数]<br />-处理兼容-animation:
<html lang="en"><head> <meta charset="UTF-8"> <title>CSS3</title> <link rel="stylesheet" href="index.css"></head><body> <div class="parent"> <div class="main"></div> <div class="d2"></div> <div class="d3">A</div> </div></body></html>
html,body{ width: 98%; height: 98%; } /*方法二*/ body{ display: flex; align-items: center;/****水平居中****/ justify-content: center;/*垂直居中*/ } .parent{ overflow: hidden; width: 500px; height: 400px; background: orange; /*方法一*/ /*margin: 0 auto;*/ position: relative; /*top: 50%;*/ /*margin-top: -200px;*//***此行等于transform:translateY(-50%)******/ } .parent div{ width: 100px; height:100px; margin: 0 auto; margin-top: 20px; } .main{ position: relative; /*top:150px;*/ background: pink; -webkit-animation: expand 0.6s ease-out infinite; -moz-animation: expand 0.6s ease-out infinite; -o-animation: expand 0.6s ease-out infinite; -ms-animation: expand 0.6s ease-out infinite; animation: expand 0.6s ease-out infinite; } .d2{ background: green; -webkit-animation: bounce 3s ease-out infinite; -moz-animation: bounce 3s ease-out infinite; -o-animation: bounce 3s ease-out infinite; -ms-animation: bounce 3s ease-out infinite; animation: bounce 3s ease-out infinite; } @keyframes bounce { 0% { transform: translate3d(0, -25px, 0); opacity: 0; } 25% { transform: translate3d(0, 10px, 0); } 50% { transform: translate3d(0, -6px, 0); } 75% { transform: translate3d(0, 2px, 0); } 100% { transform: translate3d(0, 0, 0); opacity: 1; } } @-webkit-keyframes bounce { 0% { transform: translate3d(0, -25px, 0); opacity: 0; } 25% { transform: translate3d(0, 10px, 0); } 50% { transform: translate3d(0, -6px, 0); } 75% { transform: translate3d(0, 2px, 0); } 100% { transform: translate3d(0, 0, 0); opacity: 1; } } @-moz-keyframes bounce { 0% { transform: translate3d(0, -25px, 0); opacity: 0; } 25% { transform: translate3d(0, 10px, 0); } 50% { transform: translate3d(0, -6px, 0); } 75% { transform: translate3d(0, 2px, 0); } 100% { transform: translate3d(0, 0, 0); opacity: 1; } } @-o-keyframes bounce { 0% { transform: translate3d(0, -25px, 0); opacity: 0; } 25% { transform: translate3d(0, 10px, 0); } 50% { transform: translate3d(0, -6px, 0); } 75% { transform: translate3d(0, 2px, 0); } 100% { transform: translate3d(0, 0, 0); opacity: 1; } } @keyframes expand { 0% { transform: scale3d(1, 0, 1); } 25% { transform: scale3d(1, 1.2, 1); } 50% { transform: scale3d(1, 0.85, 1); } 75% { transform: scale3d(1, 1.05, 1); } 100% { transform: scale3d(1, 1, 1); } } @-webkit-keyframes expand { 0% { transform: scale3d(1, 0, 1); } 25% { transform: scale3d(1, 1.2, 1); } 50% { transform: scale3d(1, 0.85, 1); } 75% { transform: scale3d(1, 1.05, 1); } 100% { transform: scale3d(1, 1, 1); } } @-moz-keyframes expand { 0% { transform: scale3d(1, 0, 1); } 25% { transform: scale3d(1, 1.2, 1); } 50% { transform: scale3d(1, 0.85, 1); } 75% { transform: scale3d(1, 1.05, 1); } 100% { transform: scale3d(1, 1, 1); } } @-o-keyframes expand { 0% { transform: scale3d(1, 0, 1); } 25% { transform: scale3d(1, 1.2, 1); } 50% { transform: scale3d(1, 0.85, 1); } 75% { transform: scale3d(1, 1.05, 1); } 100% { transform: scale3d(1, 1, 1); } } /*transform:rotate3d(x,y,z,deg);*/ /*transform:rotate3d(1,1,0,45deg);*/ .d3{ background: #e4393c; -webkit-animation: move 3s linear infinite; -moz-animation: move 3s linear infinite; -ms-animation: move 3s linear infinite; -o-animation: move 3s linear infinite; animation: move 3s linear infinite; } @-o-keyframes move{ 25%{ transform:rotateY(45deg); } 50%{ transform:rotateY(360deg); } 75%{ transform:rotateX(45deg); } 100%{ transform:rotateX(180deg); } } @-moz-keyframes move{ 25%{ transform:rotateY(45deg); } 50%{ transform:rotateY(360deg); } 75%{ transform:rotateX(45deg); } 100%{ transform:rotateX(180deg); } } @-webkit-keyframes move{ 25%{ transform:rotateY(45deg); } 50%{ transform:rotateY(360deg); } 75%{ transform:rotateX(45deg); } 100%{ transform:rotateX(180deg); } } @keyframes move{ 25%{ transform:rotateY(45deg); } 50%{ transform:rotateY(360deg); } 75%{ transform:rotateX(45deg); } 100%{ transform:rotateX(180deg); } }

HTML標籤和屬性的使用方法包括:1.基本用法:使用標籤如和,通過屬性如src和href添加必要信息。 2.高級用法:使用data-*自定義屬性實現複雜交互。 3.避免常見錯誤:確保屬性值用引號包圍。 4.性能優化:保持簡潔,使用標準屬性和CSS類名,確保圖像有alt屬性。掌握這些將提升網頁開發技能。

HTMLtagsdefinethestructureofawebpage,whileattributesaddfunctionalityanddetails.1)Tagslike,,andoutlinethecontent'splacement.2)Attributessuchassrc,class,andstyleenhancetagsbyspecifyingimagesources,styling,andmore,improvingfunctionalityandappearance.

HTML的未來將朝著更加語義化、功能化和模塊化的方向發展。 1)語義化將使標籤更明確地描述內容,提升SEO和無障礙訪問。 2)功能化將引入新元素和屬性,滿足用戶需求。 3)模塊化將支持組件化開發,提高代碼復用性。

htmlattributesarecrucialinwebdevelopment forcontrollingBehavior,外觀和功能

alt屬性是HTML中標籤的重要部分,用於提供圖片的替代文本。 1.當圖片無法加載時,alt屬性中的文本會顯示,提升用戶體驗。 2.屏幕閱讀器使用alt屬性幫助視障用戶理解圖片內容。 3.搜索引擎索引alt屬性中的文本,提高網頁的SEO排名。

HTML、CSS和JavaScript在網頁開發中的作用分別是:1.HTML用於構建網頁結構;2.CSS用於美化網頁外觀;3.JavaScript用於實現動態交互。通過標籤、樣式和腳本,這三者共同構築了現代網頁的核心功能。

設置標籤的lang屬性是優化網頁可訪問性和SEO的關鍵步驟。 1)在標籤中設置lang屬性,如。 2)在多語言內容中,為不同語言部分設置lang屬性,如。 3)使用符合ISO639-1標準的語言代碼,如"en"、"fr"、"zh"等。正確設置lang屬性可以提高網頁的可訪問性和搜索引擎排名。

htmlattributeseresene forenhancingwebelements'functionalityandAppearance.TheyAdDinformationTodeFineBehavior,外觀和互動,使網站互動,響應式,visalalyAppealing.AttributesLikutesLikeSlikEslikesrc,href,href,href,類,類型,類型,和dissabledtransfransformformformformformformformformformformformformformformforment


熱AI工具

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

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

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

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

熱門文章

熱工具

SublimeText3 Linux新版
SublimeText3 Linux最新版

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

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

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境