<!DOCTYPE html>
<html lang="zh-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>小例子</title>
<style media="screen">
#box {
width: 100px;
height: 100px;
padding: 100px;
border: 4px solid red;
margin: 100px auto;
perspective: 300px;
}
#val {
width: 100px;
height: 100px;
position: relative;
transform-style: preserve-3d;
transition: 2s;
transform-origin: center center -50px;
}
#val div {
position: absolute;
width: 100px;
height: 100px;
background: red;
text-align: center;
font: 40px/100px "simhei";
}
#val div:nth-of-type(1) {
top: -100px;
background: #E4DE70;
transform-origin: bottom;
transform: rotateX(90deg);
}
#val div:nth-of-type(2) {
left: -100px;
background: #9D00A2;
transform-origin: right;
transform: rotateY(-90deg);
}
#val div:nth-of-type(3) {
background: #96EF24;
}
#val div:nth-of-type(4) {
left: 100px;
background: #3D006D;
transform-origin: left;
transform: rotateY(90deg);
}
#val div:nth-of-type(5) {
top: 100px;
background: #F40090;
transform-origin: top;
transform: rotateX(-90deg);
}
#val div:nth-of-type(6) {
background: #63E90D;
transform: translateZ(-100px);
}
#box:hover #val {
transform: rotateX(340deg) rotateY(190deg) rotateZ(220deg);
}
</style>
</head>
<body>
<div id="box">
<div id="val">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
</div>
</body>
</html>
css3学习-3D变换小例子
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...