注册 登录
编程论坛 WEB前端(UI)

为甚麽无法实现3d效果

好一坨牛粪 发布于 2020-09-15 14:59, 5491 次点击
为什么无法实现3D效果,
只有本站会员才能查看附件,请 登录

程序代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>3d旋转的练习</title>
    <style>
        body
{
            perspective
: 1000px;
        
}
        section
{
            width
: 300px;
            height
: 200px;
            margin
: 100px auto;   
            background
: url(images/z1.jpg) no-repeat;
            background-size
: cover;
            position
: relative;
            transform-style
: preserve-3d;
            transition
: all 5s linear;
        
}
        section div img
{
            width
: 100%;
            height
: 100%;
            position
: absolute;
            left
: 0;
            top
: 0;
        
}
        section div:nth-child(1) img
{
            transform
: rotateY(0deg) translateZ(400px);
        
}

        section div:nth-child(2) img
{
            transform
: rotateY(60deg) translateZ(400px);
        
}

        section div:nth-child(3) img
{
            transform
: rotateY(120deg) translateZ(400px);
        
}

        section div:nth-child(4) img
{
            transform
: rotateY(180deg) translateZ(400px);
        
}

        section div:nth-child(5) img
{
            transform
: rotateY(240deg) translateZ(400px);
        
}

        section div:nth-child(6) img
{
            transform
: rotateY(300deg) translateZ(400px);
        
}

        section:hover
{
            transform
: rotateY(360deg);
        
}
   
</style>
</head>
<body>
    <section>
        <div><img src="images/1.jpg" /></div>
        <div><img src="images/2.jpg" /></div>
        <div><img src="images/3.jpg" /></div>
        <div><img src="images/4.jpg" /></div>
        <div><img src="images/5.jpg" /></div>
        <div><img src="images/6.jpg" /></div>
    </section>

</body>
</html>
1 回复
#2
yuyouxsdh2020-10-12 22:38
好厉害 这是css3吗 好原生的代码
1