关于nth-child()伪类选择器选取元素设置transform样式但是无法通过hover改变transform的问题
来源:互联网 发布:java cms垃圾回收 编辑:程序博客网 时间:2024/06/07 06:15
欢迎来到Altaba的博客 2017年5月27日22:56:46
不多说,直接上问题代码
HTML部分:
<div class="photo-view box1"> <img src="imagewall/images/full/10.jpg" alt=""/> <p>鸽子</p> <p>王阳阳毕设</p> </div> <div class="photo-view box2"> <img src="imagewall/images/full/2.jpg" alt=""/> <p>院门</p> <p>王阳阳毕设</p> </div>
css部分:
.photo-view:hover{ box-shadow:15px 15px 20px rgba(50, 50, 50, 0.6); -webkit-transform:rotate(0deg) scale(1.20); -moz-transform:rotate(0deg) scale(1.20); transform:rotate(0deg) scale(1.20); color: tomato; z-index:2; } .photo-view:nth-child(1){ top: 0px; left: 50px; -webkit-transform: rotate(30deg); -moz-transform: rotate(30deg); transform: rotate(30deg); }上面的代码用浏览器打开,会发现hover悬浮transform部分无法触发,是两种选择器选择对象不统一,预估计是hover悬浮
换作下面这box2重新获取便可通过hover改变transform样式
.photo-view:hover{ box-shadow:15px 15px 20px rgba(50, 50, 50, 0.6); -webkit-transform:rotate(0deg) scale(1.20); -moz-transform:rotate(0deg) scale(1.20); transform:rotate(0deg) scale(1.20); color: tomato; z-index:2; } .photo-view:nth-child(1){ top: 0px; left: 50px; -webkit-transform: rotate(30deg); -moz-transform: rotate(30deg); transform: rotate(30deg); } .box2{ top: 0px; left: 350px; -webkit-transform: rotate(10deg); -moz-transform: rotate(10deg); transform: rotate(10deg); }或者改变一下hover前缀也可通过hover改变transform样式
.photo-view:nth-child(1):hover{ box-shadow:15px 15px 20px rgba(50, 50, 50, 0.6); -webkit-transform:rotate(0deg) scale(1.20); -moz-transform:rotate(0deg) scale(1.20); transform:rotate(0deg) scale(1.20); color: tomato; z-index:2; } .photo-view:nth-child(1){ top: 0px; left: 50px; -webkit-transform: rotate(30deg); -moz-transform: rotate(30deg); transform: rotate(30deg); }
便能够通过hover改变transform样式。
阅读全文
0 0
- 关于nth-child()伪类选择器选取元素设置transform样式但是无法通过hover改变transform的问题
- :nth-child()伪类选择器
- CSS伪类选择器nth-child 选择3的倍数个元素写法
- CSS3:nth-child()伪类选择器,奇偶数行自定义样式first-child
- 强大的nth-child(n)伪类选择器玩法 企
- CSS3伪类选择器:nth-child()
- CSS3伪类选择器:nth-child()
- CSS3 :nth-child()伪类选择器
- CSS3伪类选择器:nth-child()
- CSS3 :nth-child()伪类选择器
- CSS3 :nth-child()伪类选择器
- CSS3 伪类选择器 nth-child()说明
- CSS3 :nth-child()伪类选择器
- CSS3 :nth-child()伪类选择器
- CSS3伪类选择器:nth-child()
- web CSS3伪类选择器 :nth-child()
- CSS3:nth-child()伪类选择器…
- CSS3 :nth-child()伪类选择器
- 设置Eclipse可以Debug模式调试JDK源码,并显示局部变量的值
- 计算机网络第五版谢希仁答案
- 在JSP页面中测试链接数据库(MYSQL)是否成功
- ogl 第一个三角形
- Java 编程题目 第十一题
- 关于nth-child()伪类选择器选取元素设置transform样式但是无法通过hover改变transform的问题
- 心得
- 深入浅出聊聊企业级API网关
- dfs + 最小生成树 hdoj4126 Genghis Khan the Conqueror
- 基于深度神经网络技术提高产品生产良品率的研究
- 道路 AND 机器学习 OR 软件工程
- ASP.NET服务器控件
- 2017第八届蓝桥杯决赛之旅
- java 文件File 文件的创建 删去 重命名