html中图片旋转_HTML之3D旋转图片

你还在愁女朋友的生日礼物吗,来啦,3D旋转图:

ecb7de8a2cc4f424b507d316381729ae.gif

运用图片:111.jpg,222.jpg

                                                     111.jpg:

cb809793139ecc66f5c7d0ac30d53ff8.png

222.jpg:

ac453a7196610714c7f56dd848d47a0b.png

HTML代码:

<html>  <head>    <meta charset="utf-8" />    <title>3Dboxtitle>    <link rel="stylesheet" type="text/css"     href="./css/index.css"/>  head>  <body>            <div class="box">            <ul class="minbox">        <li>li>        <li>li>        <li>li>        <li><li>        <li>li>              ul>            <ul class="maxbox">        <li>li>        <li>li>        <li>li>        <li>li>        <li>li>        <li>li>      ul>    div>          body>html>

CSS代码:

*{   margin: 0; /*去掉外边距*/  padding: 0; /*去掉内边距*/}.box{  width: 200px; /*宽度*/  height: 200px; /*高度*/  position: absolute;/*绝对定位*/  top: 30%; /*与顶部的距离*/  left: 40%;/*与左侧的距离*/  transform-style: preserve-3d; /*^_^只有设置了此属性才有z轴*/  transform: rotateX(-90deg);/*绕x轴旋转*/  /*使用动画*/  animation: move 10s 100 linear;  /*动画名称  动画执行的时间  次数   匀速*/}ul{  list-style: none; /*去掉点*/}/*定义动画*/@keyframes move{  from{ transform: rotateX(-30deg) rotateY(0deg); }  to{transform: rotateX(-30deg) rotateY(360deg);}}/*小盒子*/.minbox{  width: 100px; /*宽度*/  height: 100px;/*高度*/  position: absolute; /*绝对定位*/  left: 50px;  top: 50px;  transform-style: preserve-3d;/*设置为3d图形*/}.minbox > li{  width: 100px;  height: 100px;  border: 1px solid black;/*边框宽度  样式   颜色*/  font-size: 50px;/*设置字体大小*/  text-align: center;/*文本水平居中*/  line-height: 100px;/*让行高等于高度,达到垂直居中的效果*/  position: absolute;  left: 0;   top: 0;  background-image: url(../img/111.jpg);//可以换成你喜欢的照片  background-size: 100px 100px;}.minbox > li:nth-child(1){  transform: translateZ(50px);}.minbox > li:nth-child(2){  transform: translateZ(-50px);}.minbox > li:nth-child(3){  transform: rotateY(90deg) translateZ(50px);}.minbox > li:nth-child(4){  transform: rotateY(90deg) translateZ(-50px);}.minbox > li:nth-child(5){  transform: rotateX(90deg) translateZ(50px);}.minbox > li:nth-child(6){  transform: rotateX(90deg) translateZ(-50px);} /*大盒子*/.maxbox{  width: 200px; /*宽度*/  height: 200px;/*高度*/  position: absolute; /*绝对定位*/  left: ;  top: 0;  transform-style: preserve-3d;/*设置为3d图形*/}.maxbox > li{  width: 200px;  height: 200px;  border: 1px solid black;/*边框宽度  样式   颜色*/  font-size: 50px;/*设置字体大小*/  text-align: center;/*文本水平居中*/  line-height: 200px;/*让行高等于高度,达到垂直居中的效果*/  position: absolute;  left: 0;  top: 0;  background-image: url(../img/222.jpg);//可以换成你喜欢的照片  background-size: 200px 200px;  opacity: 0.8;}.maxbox > li:nth-child(1){  transform: translateZ(100px);}.maxbox > li:nth-child(2){  transform: translateZ(-100px);}.maxbox > li:nth-child(3){  transform: rotateY(90deg) translateZ(100px);}.maxbox > li:nth-child(4){  transform: rotateY(90deg) translateZ(-100px);}.maxbox > li:nth-child(5){  transform: rotateX(90deg) translateZ(100px);}.maxbox > li:nth-child(6){  transform: rotateX(90deg) translateZ(-100px);}.box:hover ul.maxbox > li{  width: 400px;  height: 400px;  background-size: 400px 400px ;  top: -100px;  left: -100px;}.box:hover ul.maxbox > li:nth-child(1){  transform: translateZ(300px);}.box:hover ul.maxbox > li:nth-child(2){  transform: translateZ(-300px);}.box:hover ul.maxbox > li:nth-child(3){  transform:  rotateY(90deg) translateZ(300px);}.box:hover ul.maxbox > li:nth-child(4){  transform:  rotateY(90deg) translateZ(-300px);}.box:hover ul.maxbox > li:nth-child(5){  transform: rotateX(90deg) translateZ(300px);}.box:hover ul.maxbox > li:nth-child(6){  transform: rotateX(90deg) translateZ(-300px);}
  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值