
直接上代码
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- <link rel="stylesheet" href="css/mystyle.css">
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" />
- </head>
- <body>
- <div class="search-box">
- <input class="search-txt" placeholder="Type to search" type="text">
- <a class="search-btn" href="#">
- <i class="fas fa-search"></i>
- </a>
- </div>
- </body>
- </html>
css:
- body{
- margin: 0;
- padding: 0;
- background-color: #0984e3;
- }
- .search-box{
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%,-50%);
- background-color: #2f3640;
- height: 40px;
- border-radius: 40px;
- padding: 10px;
- }
- /* 特效 */
- .search-box:hover > .search-txt{
- width: 240px;
- padding: 0px 6px;
- }
- .search-box:hover > .search-btn{
- background-color: white;
- }
- .search-btn{
- color: #e84118;
- width: 40px;
- height: 40px;
- background-color: #2f3640;
- display:flex;
- text-decoration: none;
- border-radius: 50%;
- /* 左右居中 */
- justify-content:center;
- /* 上下居中 */
- align-items: center;
- transition: 0.4s;
- float: right;
- }
- .search-txt{
- background: none;
- box-sizing: border-box;
- color: white;
- border: none;
- outline: none;
- line-height: 40px;
- font-size: 16px;
- width: 0px;
- transition: 1s;
- float: left;
- }
这个来源于b站的一个大佬:
不愿透漏姓名的红领巾大会员
大家有想法的可以去看看他往期的视频!
欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739
评价
排名
2
文章
634
粉丝
44
评论
93
docker中Sware集群与service
尘叶心繁 : 想学呀!我教你呀
一个bug让程序员走上法庭 索赔金额达400亿日元
叼着奶瓶逛酒吧 : 所以说做程序员也要懂点法律知识
.net core 塑形资源
剑轩 : 收藏收藏
映射AutoMapper
剑轩 :
好是好,这个对效率影响大不大哇,效率高不高
一个bug让程序员走上法庭 索赔金额达400亿日元
剑轩 : 有点可怕
ASP.NET Core 服务注册生命周期
剑轩 :
http://www.tnblog.net/aojiancc2/article/details/167
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:
50010702506256


欢迎加群交流技术
饰心
贴上效果图,更赞