达拉~ 2022-03-29 10:43 采纳率: 64.7%
浏览 27
已结题

伪元素前面使用标签,用标签选择就只生效阴影,旋转和缩放是不生效的,用伪类就可以生效


<style>

        img{
            display: inline-block;
            position: absolute;
            padding: 10px;
            border: 1px solid black;
            background-color: #fff;
            transition:all 0.6s ease-in-out;
            box-shadow: 0 0 10px rgba(0, 0, 0, .5);
        }
        .img:hover{
            transform: rotateZ(0deg) scale(1.3);
            z-index: 1;
            box-shadow: none;

        }
        img:nth-child(1){
            top: 100px;
            left: 100px;
            transform: rotateZ(30deg);
        }
        img:nth-child(2){
            top: 100px;
            left: 200px;
            transform: rotateZ(60deg);
        }
        img:nth-child(3){
            top: 100px;
            left: 400px;
            transform: rotateZ(70deg);
        }
        img:nth-child(4){
            top: 100px;
            left: 550px;
            transform: rotateZ(10deg);
        }
        img:nth-child(5){
            top: 100px;
            left: 900px;
            transform: rotateZ(30deg);
        }
        img:nth-child(6){
            top: 100px;
            left: 400px;
            transform: rotateZ(20deg);
        }
        img:nth-child(7){
            top: 400px;
            left: 300px;
            transform: rotateZ(40deg);
        }
        img:nth-child(8){
            top: 400px;
            left: 100px;
            transform: rotateZ(40deg);
        }
        img:nth-child(9){
            top: 400px;
            left: 600px;
            transform: rotateZ(40deg);
        }
        img:nth-child(10){
            top: 400px;
            left: 700px;
            transform: rotateZ(40deg);
        }


    </style>
<body>
    <div>
        <img src="./1.jpg" width="200px" alt="" class="img">
        <img src="./2.jpg" width="200px" alt="" class="img">
        <img src="./3.jpg" width="200px" alt="" class="img">
        <img src="./4.jpg" width="200px" alt="" class="img">
        <img src="./5.jpg" width="200px" alt="" class="img">
        <img src="./6.jpg" width="200px" alt="" class="img">
        <img src="./7.jpg" width="200px" alt="" class="img">
        <img src="./8.jpg" width="200px" alt="" class="img">
        <img src="./9.jpg" width="200px" alt="" class="img">
        <img src="./10.jpg" width="200px" alt="" class="img">
    
    </div>
</body>

他这个使用img选择伪元素时,只有那个transform不生效,但是用伪类选择就可以生效

  • 写回答

2条回答 默认 最新

  • bekote 2022-03-29 11:16
    关注

    这里吗?有生效的啊

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月6日
  • 已采纳回答 3月29日
  • 修改了问题 3月29日
  • 创建了问题 3月29日

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向