js+css3图片3D旋转可以多用

 时间:2024-11-03 19:29:07

1、准备好需要用到的图标。

js+css3图片3D旋转可以多用

2、新建html文档。

js+css3图片3D旋转可以多用

3、书写hmtl代艨位雅剖码。<div class="htmleaf-container"> <h1>3D Rotating Carousel Examples</h1> <h2>Three images</h2> <div class="carousel"> <figure> <img src="img/1.jpg" alt=""> <img src="img/2.jpg" alt=""> <img src="img/3.jpg" alt=""> </figure> <nav> <button class="nav prev">Prev</button> <button class="nav next">Next</button> </nav> </div> <h2>Four images</h2> <div class="carousel"> <figure> <img src="img/1.jpg" alt=""> <img src="img/2.jpg" alt=""> <img src="img/3.jpg" alt=""> <img src="img/4.jpg" alt=""> </figure> <nav> <button class="nav prev">Prev</button> <button class="nav next">Next</button> </nav> </div> <h2>Eight images</h2> <div class="carousel"> <figure> <img src="img/1.jpg" alt=""> <img src="img/2.jpg" alt=""> <img src="img/3.jpg" alt=""> <img src="img/4.jpg" alt=""> <img src="img/5.jpg" alt=""> <img src="img/6.jpg" alt=""> <img src="img/7.jpg" alt=""> <img src="img/8.jpg" alt=""> </figure> <nav> <button class="nav prev">Prev</button> <button class="nav next">Next</button> </nav> </div> <h2>Eight images, with 20px gap</h2> <div class="carousel" data-gap="20"> <figure> <img src="img/1.jpg" alt=""> <img src="img/2.jpg" alt=""> <img src="img/3.jpg" alt=""> <img src="img/4.jpg" alt=""> <img src="img/5.jpg" alt=""> <img src="img/6.jpg" alt=""> <img src="img/7.jpg" alt=""> <img src="img/8.jpg" alt=""> </figure> <nav> <button class="nav prev">Prev</button> <button class="nav next">Next</button> </nav> </div> <h2>Eight images, with 80px gap</h2> <div class="carousel" data-gap="80"> <figure> <img src="img/1.jpg" alt=""> <img src="img/2.jpg" alt=""> <img src="img/3.jpg" alt=""> <img src="img/4.jpg" alt=""> <img src="img/5.jpg" alt=""> <img src="img/6.jpg" alt=""> <img src="img/7.jpg" alt=""> <img src="img/8.jpg" alt=""> </figure> <nav> <button class="nav prev">Prev</button> <button class="nav next">Next</button> </nav> </div> <h2>Hidden backfaces</h2> <div class="carousel" data-gap="20" data-bfc> <figure> <img src="img/1.jpg" alt=""> <img src="img/2.jpg" alt=""> <img src="img/3.jpg" alt=""> <img src="img/4.jpg" alt=""> <img src="img/5.jpg" alt=""> <img src="img/6.jpg" alt=""> <img src="img/7.jpg" alt=""> <img src="img/8.jpg" alt=""> </figure> <nav> <button class="nav prev">Prev</button> <button class="nav next">Next</button> </nav> </div></div>

js+css3图片3D旋转可以多用

4、初始化css代码。<style>body, html { font-size: 100%; padding: 0; margin: 0; }*, *:after, *:before { box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }.clearfix:before, .clearfix:after { content: " "; display: table; }.clearfix:after { clear: both; }body { font-family: "Microsoft YaHei", "Segoe UI", "Lucida Grande", Helvetica, Arial, sans-serif; }.htmleaf-links a { color: rgba(255, 255, 255, 0.6); outline: none; text-decoration: none; transition: 0.2s; transition: 0.2s; }.htmleaf-links a:hover, .htmleaf-links a:focus { color: #74777b; text-decoration: none; }.htmleaf-container { margin: 0 auto; }</style>

js+css3图片3D旋转可以多用

5、书写css代码。body { margin: 0; font-family: 'Roboto&垆杪屑丝#39;, sans-serif; font-size: 16px; }h1 { text-align: center; margin-bottom: 1.5em; }h2 { text-align: center; color: #555; margin-bottom: 0; }.carousel { padding: 20px; --perspective: 500px; perspective: 500px; overflow: hidden; display: --box; display: -ms-flexbox; display: flex; --box-orient: vertical; --box-direction: normal; -ms-flex-direction: column; flex-direction: column; --box-align: center; -ms-flex-align: center; align-items: center; }.carousel > * { --box-flex: 0; -ms-flex: 0 0 auto; flex: 0 0 auto; }.carousel figure { margin: 0; width: 40%; --transform-style: preserve-3d; transform-style: preserve-3d; --transition: --transform 0.5s; transition: --transform 0.5s; transition: transform 0.5s; transition: transform 0.5s, --transform 0.5s; }.carousel figure img { width: 100%; box-sizing: border-box; padding: 0 0px; }.carousel figure img:not(:first-of-type) { position: absolute; left: 0; top: 0; }.carousel nav { display: --box; display: -ms-flexbox; display: flex; --box-pack: center; -ms-flex-pack: center; justify-content: center; margin: 20px 0 0; }.carousel nav button { --box-flex: 0; -ms-flex: 0 0 auto; flex: 0 0 auto; margin: 0 5px; cursor: pointer; color: #333; background: none; border: 1px solid; letter-spacing: 1px; padding: 5px 10px; }

js+css3图片3D旋转可以多用

6、代码整体结构。

js+css3图片3D旋转可以多用

7、查看效果。

js+css3图片3D旋转可以多用
  • 卖场购物篮该放在哪儿?
  • 开放式书房设计需注意的地方
  • 图片工厂如何给图片添加3D边框和3D网格效果
  • 如何提高自己在新领域的科研能力
  • 日式料理店装修注意事项需留心
  • 热门搜索
    胰腺炎的症状是什么 天然维生素e upset是什么意思 5s是什么意思 股票换手是什么意思 什么眼霜好 养殖泥鳅投资多少钱 phd是什么意思 361度运动鞋 dg是什么牌子