当前位置: 首页 > news >正文

CSS特效001:鼠标放div上,实现旋转、放大、移动等效果

GPT能够很好的应用到我们的代码开发中,能够提高开发速度。你可以利用其代码,做出一定的更改,然后实现效能。

css实战中,经常会看到这样的场景,鼠标放到一个图片或者一个div块状时候,会出现旋转、放大、移动等效果。 实现起来也是蛮简单的,虽然简单,但是却很重要,能增加页面的灵动性。

效果图

在这里插入图片描述

源代码

/*
* @Author: 大剑师兰特(xiaozhuanlan),还是大剑师兰特(CSDN)
* @此源代码版权归大剑师兰特所有,可供学习或商业项目中借鉴,未经授权,不得重复地发表到博客、论坛,问答,git等公共空间或网站中。
* @Email: 2909222303@qq.com
* @weixin: gis-dajianshi
* @First published in CSDN
* @First published time: 2022-11-06
*/
<template><div class="container"><div class="top"><h3>鼠标移上去旋转、放大、移动</h3><div class="author">大剑师兰特, 还是大剑师兰特,gis-dajianshi</div></div><div style="width:640px ; margin:0 auto;"><div class="itemBox img1">360°旋转 </div><div class="itemBox img2">放大</div><div class="itemBox img3">旋转放大</div><div class="itemBox img4">上下左右移动 </div></div></div>
</template><style scoped>.container {width: 1000px;height: 580px;margin: 50px auto;border: 1px solid green;position: relative;}.top {margin: 0 auto 130px;padding: 10px 0;background: orange;color: #fff;}.itemBox {width: 120px;height: 120px;line-height: 120px;margin: 20px;background-color: #5cb85c;float: left;font-size: 12px;text-align: center;color: #fff;cursor: pointer;}/*效果一:360°旋转 修改rotate(旋转度数)*/.img1 {transition: All 0.4s ease-in-out;-webkit-transition: All 0.4s ease-in-out;-moz-transition: All 0.4s ease-in-out;-o-transition: All 0.4s ease-in-out;}.img1:hover {transform: rotate(360deg);-webkit-transform: rotate(360deg);-moz-transform: rotate(360deg);-o-transform: rotate(360deg);-ms-transform: rotate(360deg);}/*效果二:放大 修改scale(放大的值)*/.img2 {transition: All 0.4s ease-in-out;-webkit-transition: All 0.4s ease-in-out;-moz-transition: All 0.4s ease-in-out;-o-transition: All 0.4s ease-in-out;}.img2:hover {transform: scale(1.2);-webkit-transform: scale(1.2);-moz-transform: scale(1.2);-o-transform: scale(1.2);-ms-transform: scale(1.2);}/*效果三:旋转放大 修改rotate(旋转度数) scale(放大值)*/.img3 {transition: All 0.4s ease-in-out;-webkit-transition: All 0.4s ease-in-out;-moz-transition: All 0.4s ease-in-out;-o-transition: All 0.4s ease-in-out;}.img3:hover {transform: rotate(360deg) scale(1.2);-webkit-transform: rotate(360deg) scale(1.2);-moz-transform: rotate(360deg) scale(1.2);-o-transform: rotate(360deg) scale(1.2);-ms-transform: rotate(360deg) scale(1.2);}/*效果四:上下左右移动 修改translate(x轴,y轴)*/.img4 {transition: All 0.4s ease-in-out;-webkit-transition: All 0.4s ease-in-out;-moz-transition: All 0.4s ease-in-out;-o-transition: All 0.4s ease-in-out;}.img4:hover {transform: translate(0, -10px);-webkit-transform: translate(0, -10px);-moz-transform: translate(0, -10px);-o-transform: translate(0, -10px);-ms-transform: translate(0, -10px);}
</style>
http://www.lryc.cn/news/222275.html

相关文章:

  • gin 快速入门手册
  • Window下安装 Mongodb,并实现单点事务
  • 【通信原理】第三章 随机过程——例题
  • 线性【SVM】数学原理和算法实现
  • R语言中的函数26:polyroot多项式求根函数
  • 2023年辽宁省数学建模竞赛A题铁路车站的安全标线
  • 半导体工厂将应用哪些制造创新技术?
  • [unity]深色模式/浅色模式
  • 在react中组件间过渡动画如何实现?
  • 解析找不到msvcr100.dll文件的解决方法,4个方法修复msvcr100.dll
  • 达梦主备部署
  • 后期混音效果全套插件Waves 14 Complete mac中文版新增功能
  • HTML5笔记
  • 前端架构师需要解决那些问题
  • 使用python快速搭建接口自动化测试脚本实战总结
  • android studio 字节码查看工具jclasslib bytecode viewer
  • Ubuntu上搭建FTP服务
  • unity打AB包,AssetBundle预制体与图集(三)
  • 在Javascript中为什么 0.1+0.2 不等于0.3 ? 源代码详细解析
  • MATLAB|热力日历图
  • 《golang设计模式》第三部分·行为型模式-05-仲裁者/中介模式(Mediator)
  • 7天入门python系列之准备工作
  • Go语言~反射
  • 详解交叉验证中【KFold】【Stratified-KFold】【StratifiedShuffleSplit】的区别
  • 数学建模比赛中常用的建模提示词(数模prompt)
  • Spark 新特性+核心回顾
  • STM32 TIM定时器,配置,详解(1)
  • Helix Toolkit:为.NET开发者带来的3D视觉盛宴
  • PHP分类信息网站源码系统 电脑+手机+微信端三合一 带完整前后端部署教程
  • 2023年辽宁省数学建模竞赛B题数据驱动的水下导航适配区分类预测