热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

【CSS3】纯css3悬停文字线条边框动画特效

演示效果如下:<!doctypehtml><html><head><metacharsetutf-8><tit

演示效果如下:

这里写图片描述


<html>
<head>
<meta charset="utf-8">
<title>按钮悬停动画title>

<style> html, body { color: white; background: #323232; font-weight: lighter; } h1, h2, h3, h4 { font-family: "Oswald"; } .wrapper { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; -ms-flex-wrap: wrap; flex-wrap: wrap; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; width: 100vw; height: 100vh; } .wrapper .row { display: -webkit-box; display: -ms-flexbox; display: flex; margin: 10px 0; } .wrapper h2 { font-size: 1.8em; } .button { position: relative; cursor: pointer; color: white; font-family: "Lato"; font-size: 1.5em; padding: 0.5em 1em 0.65em; margin: 0 10px; } .button .inner { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .button:nth-of-type(1):before, .button:nth-of-type(1):after, .button:nth-of-type(1) .inner:before, .button:nth-of-type(1) .inner:after { background-color: #ffa726; } .button:nth-of-type(2):before, .button:nth-of-type(2):after, .button:nth-of-type(2) .inner:before, .button:nth-of-type(2) .inner:after { background-color: #26a69a; } .button:nth-of-type(3):before, .button:nth-of-type(3):after, .button:nth-of-type(3) .inner:before, .button:nth-of-type(3) .inner:after { background-color: #7e57c2; } .button:before, .button:after, .button .inner:before, .button .inner:after { position: absolute; content: ""; display: block; -webkit-transition: -webkit-transform 0.3s; transition: -webkit-transform 0.3s; transition: transform 0.3s; transition: transform 0.3s, -webkit-transform 0.3s; } .button.horizontal:before, .button.horizontal:after, .button.both:before, .button.both:after { left: 0; width: 100%; height: 2px; -webkit-transform: scaleX(0); transform: scaleX(0); } .button.horizontal .inner:before, .button.horizontal .inner:after, .button.both .inner:before, .button.both .inner:after { top: 0; width: 2px; height: 100%; -webkit-transform: scaleY(0); transform: scaleY(0); } .button.horizontal .inner:before, .button.both .inner:before { left: 0; } .button.horizontal .inner:after, .button.both .inner:after { right: 0; } .button.horizontal .inner:hover:before, .button.horizontal .inner:hover:after, .button.both .inner:hover:before, .button.both .inner:hover:after { -webkit-transform: scaleY(1); transform: scaleY(1); } .button.horizontal:before, .button.both:before { top: 0; } .button.horizontal:after, .button.both:after { bottom: 0; } .button.horizontal:hover:before, .button.horizontal:hover:after, .button.both:hover:before, .button.both:hover:after { -webkit-transform: scaleX(1); transform: scaleX(1); } .button.horizontal:hover .inner:before, .button.horizontal:hover .inner:after, .button.both:hover .inner:before, .button.both:hover .inner:after { -webkit-transform: scaleY(1); transform: scaleY(1); } .button.horizontal.clockwise .inner:before, .button.both.clockwise .inner:before { -webkit-transform-origin: top center; transform-origin: top center; } .button.horizontal.clockwise .inner:after, .button.both.clockwise .inner:after { -webkit-transform-origin: bottom center; transform-origin: bottom center; } .button.horizontal.clockwise:before, .button.both.clockwise:before { -webkit-transform-origin: right center; transform-origin: right center; } .button.horizontal.clockwise:after, .button.both.clockwise:after { -webkit-transform-origin: left center; transform-origin: left center; } .button.horizontal.clockwise:hover .inner:before, .button.both.clockwise:hover .inner:before { -webkit-transform-origin: bottom center; transform-origin: bottom center; } .button.horizontal.clockwise:hover .inner:after, .button.both.clockwise:hover .inner:after { -webkit-transform-origin: top center; transform-origin: top center; } .button.horizontal.clockwise:hover:before, .button.both.clockwise:hover:before { -webkit-transform-origin: left center; transform-origin: left center; } .button.horizontal.clockwise:hover:after, .button.both.clockwise:hover:after { -webkit-transform-origin: right center; transform-origin: right center; } .button.horizontal.counterclockwise .inner:before, .button.both.counterclockwise .inner:before { -webkit-transform-origin: bottom center; transform-origin: bottom center; } .button.horizontal.counterclockwise .inner:after, .button.both.counterclockwise .inner:after { -webkit-transform-origin: top center; transform-origin: top center; } .button.horizontal.counterclockwise:before, .button.both.counterclockwise:before { -webkit-transform-origin: left center; transform-origin: left center; } .button.horizontal.counterclockwise:after, .button.both.counterclockwise:after { -webkit-transform-origin: right center; transform-origin: right center; } .button.horizontal.counterclockwise:hover .inner:before, .button.both.counterclockwise:hover .inner:before { -webkit-transform-origin: top center; transform-origin: top center; } .button.horizontal.counterclockwise:hover .inner:after, .button.both.counterclockwise:hover .inner:after { -webkit-transform-origin: bottom center; transform-origin: bottom center; } .button.horizontal.counterclockwise:hover:before, .button.both.counterclockwise:hover:before { -webkit-transform-origin: right center; transform-origin: right center; } .button.horizontal.counterclockwise:hover:after, .button.both.counterclockwise:hover:after { -webkit-transform-origin: left center; transform-origin: left center; } .button.vertical:before, .button.vertical:after { top: 0; width: 2px; height: 100%; -webkit-transform: scaleY(0); transform: scaleY(0); } .button.vertical:before { left: 0; } .button.vertical:after { right: 0; } .button.vertical:hover:before, .button.vertical:hover:after { -webkit-transform: scaleY(1); transform: scaleY(1); } .button.vertical.clockwise:before { -webkit-transform-origin: top center; transform-origin: top center; } .button.vertical.clockwise:after { -webkit-transform-origin: bottom center; transform-origin: bottom center; } .button.vertical.clockwise:hover:before { -webkit-transform-origin: bottom center; transform-origin: bottom center; } .button.vertical.clockwise:hover:after { -webkit-transform-origin: top center; transform-origin: top center; } .button.vertical.counterclockwise:before { -webkit-transform-origin: bottom center; transform-origin: bottom center; } .button.vertical.counterclockwise:after { -webkit-transform-origin: top center; transform-origin: top center; } .button.vertical.counterclockwise:hover:before { -webkit-transform-origin: top center; transform-origin: top center; } .button.vertical.counterclockwise:hover:after { -webkit-transform-origin: bottom center; transform-origin: bottom center; } .codepen-link { position: absolute; bottom: 30px; right: 30px; height: 40px; width: 40px; z-index: 10; border-radius: 50%; box-sizing: border-box; background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/544318/logo.jpg"); background-position: center center; background-size: cover; opacity: 0.5; -webkit-transition: all 0.25s; transition: all 0.25s; } .codepen-link:hover { opacity: 0.8; box-shadow: 0 0 6px #efefef; } style>
head>
<body>

<div class="wrapper">
  <h2>Clockwiseh2>
  <div class="row">
    <div class="button clockwise horizontal">Horizontaldiv>
    <div class="button clockwise vertical">Verticaldiv>
    <div class="button clockwise both">Both
      <div class="inner">div>
    div>
  div>
  <h2>Counter-clockwiseh2>
  <div class="row">
    <div class="button counterclockwise horizontal">Horizontaldiv>
    <div class="button counterclockwise vertical">Verticaldiv>
    <div class="button counterclockwise both">Both
      <div class="inner">div>
    div>
  div>
div>

body>
html>

推荐阅读
  • 使用HTML创建弹出框以便用户输入信息
    在做项目的过程中,我们时常需要进行一些弹框操作,比如在后台管理时需要进行的一些增删改操作,这个时候我们需要使用到弹框,或者在 ... [详细]
  • 微软头条实习生分享深度学习自学指南
    本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • iOS超签签名服务器搭建及其优劣势
    本文介绍了搭建iOS超签签名服务器的原因和优势,包括不掉签、用户可以直接安装不需要信任、体验好等。同时也提到了超签的劣势,即一个证书只能安装100个,成本较高。文章还详细介绍了超签的实现原理,包括用户请求服务器安装mobileconfig文件、服务器调用苹果接口添加udid等步骤。最后,还提到了生成mobileconfig文件和导出AppleWorldwideDeveloperRelationsCertificationAuthority证书的方法。 ... [详细]
  • 本文介绍了使用Python编写购物程序的实现步骤和代码示例。程序启动后,用户需要输入工资,并打印商品列表。用户可以根据商品编号选择购买商品,程序会检测余额是否充足,如果充足则直接扣款,否则提醒用户。用户可以随时退出程序,在退出时打印已购买商品的数量和余额。附带了完整的代码示例。 ... [详细]
  • JavaScript实现拖动对话框效果
    原标题:JavaScript实现拖动对话框效果代码实现:<!DOCTYPEhtml><htmllan ... [详细]
  • ext将html代码转为字符串,在iOS中将HTML转换为NSAttributedString
    在iOS7中,UIKit添加了一个initWithData:options:documentAttributes:error ... [详细]
  • HTML制作简单首页导航
    h1大标题:李广程的作业列表查看演示地址一:http:js.lgcweb.cn查看演示备用地址:http:39.105.0.128Ja ... [详细]
  • 本文介绍了南邮ctf-web的writeup,包括签到题和md5 collision。在CTF比赛和渗透测试中,可以通过查看源代码、代码注释、页面隐藏元素、超链接和HTTP响应头部来寻找flag或提示信息。利用PHP弱类型,可以发现md5('QNKCDZO')='0e830400451993494058024219903391'和md5('240610708')='0e462097431906509019562988736854'。 ... [详细]
  • 本文介绍了Android 7的学习笔记总结,包括最新的移动架构视频、大厂安卓面试真题和项目实战源码讲义。同时还分享了开源的完整内容,并提醒读者在使用FileProvider适配时要注意不同模块的AndroidManfiest.xml中配置的xml文件名必须不同,否则会出现问题。 ... [详细]
  • Scrapy 爬取图片
    1.创建Scrapy项目scrapystartprojectCrawlMeiziTuscrapygenspiderMeiziTuSpiderhttps:movie.douban.c ... [详细]
  • Python爬虫爬点大家喜欢的东西
    要说最美好的欲望莫过于看黑丝美眉。一、技术路线requests:网页请求BeautifulSoup:解析html网页re:正则表达式& ... [详细]
  • 就是一个简单CSS3动画.light_pc{width:93px;height:9px;position:absolute;top:0;left:50%;margin-left:- ... [详细]
author-avatar
平凡无求
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有