html5 - 添加了伪元素 但是查看元素看不到

查看:925
本文介绍了html5 - 添加了伪元素 但是查看元素看不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(2) {
    position: absolute;
    top: 23%;
    left: 45%;
    animation: rotate_flower1 2.5s ease-in infinite;
    /*animation: rotate_flower2 2.5s ease-out infinite;*/
    animation-fill-mode: forwards;
}
.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(2)::after{
    content: '';
    position: absolute;
    display: block;
    top: 23%;
    left: 45%;
    width: 2.5em;
    /*animation: rotate_flower1 2.5s ease-in infinite;*/
    animation: rotate_flower2 2.5s ease-out infinite;
    animation-fill-mode: forwards;
}

是想通过这样的方式设置两个方向的动画 叠加起来出现曲线的效果
但是现在添加的伪元素在查看元素时并看不到请问为什么
哪里写错了

解决方案

如果你的 img 中的 src 是一个无效的地址,那么你的 ::after 或者 ::before 或许还可以在个别浏览器中看到,但是,如果 src 是一个正确的有效的地址,那么这个时候是没有伪元素的。

单标签元素是不存在伪元素的。

这篇关于html5 - 添加了伪元素 但是查看元素看不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆