css3 缓动和左右下划线特效

可以看下这两个特效的思路,由此推出别的特效的思路,其实都差不多的.

01.png
01.png
<!DOCTYPE html>
<html>

   <head>
       <meta charset="UTF-8">
       <title></title>
       <style type="text/css">
           .btn {
               display: block;
               margin: 100px auto;
               position: relative;
               width: 200px;
               text-decoration: none;
               text-align: center;
               font-size: 20px;
               color: #333;
           }
           
           .btn:before {
               content: "";
               position: absolute;
               left: 50%;
               bottom: -2px;
               width: 0;
               height: 1px;
               background: #4285f4;
               transition: all .3s;
           }
           
           .btn:hover:before {
               width: 100%;
               height: 2px;
               left: 0;
           }
           .box {
               margin: 0 auto;
               width: 500px;
               height: 300px;
               border: 8px solid #F5F6F7;
               margin-top: 10px;
               position: relative;
               overflow: hidden;
           }
           
           .box p {
               width: 100%;
               position: absolute;
               bottom: 0px;
               background: rgba(4, 58, 117, 1);
               margin: 0;
               opacity: 0;
               transition: all 0.35s linear;
               display: -webkit-box;
               -webkit-line-clamp: 2;
               -webkit-box-orient: vertical;
               overflow: hidden;
               text-overflow: ellipsis;
               text-indent: 20px;
               color: white;
           }
           
           .box img {
               display: block;
               width: 100%;
               height: 300px;
               transition: all 0.35s linear;
               position: absolute;
               transform: rotate(0) translateY(0px);
           }
           
           .box:hover img {
               transform: rotate(0deg) translateY(-35px);
           }
           
           .box:hover p {
               opacity: 1;
           }
       </style>
   </head>

   <body>

       <a href="#" class="btn">左右下划线</a>
       <div class="box">
           ![](img/01.jpg)
           <p>Meat from the ribMeat from the ribMeat from the ribMeat from the ribMeat from the ribMeat from the rib section tends to be tender and well marbled with the fat that makes steaks and roasts juicy and fl.</p>
       </div>
   </body>

</html>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 178,372评论 25 709
  • 抱怨,就像一块遮羞布,人们总想借用它的虚张声势来遮挡自己的无能、无知、懦弱和粗劣。 面对挫折、问题和困难的时候,抱...
    梅洛的听雨轩阅读 899评论 2 1
  • 很少做梦,噩梦更是没有。但昨晚却做了很不好的梦。关于儿子,很危急,想联系老公,却没带手机,找别人借,大家都不借。孩...
    吾书吾心阅读 129评论 0 0
  • 你见或者不见我, 我就在这里, 不悲不喜, 默守百年, 不离不弃。 阅尽世事沧桑, 看尽人间百态, 苍老的是容颜,...
    话梅糖_f83d阅读 200评论 0 3
  • 生活不可能像你想象得那么好 但也不会像你想象得那么糟 我觉得人的脆弱和坚强都超乎自己的想象 有时,我可能脆弱得一句...
    五月星晴阅读 240评论 0 0

友情链接更多精彩内容