8款纯CSS3打造的精美搜索框前端样式,轻松提升网页交互体验

8款纯CSS3打造的精美搜索框前端样式,轻松提升网页交互体验

浏览次数:
作者: 墨鱼
信息来源: 本站原创
更新日期: 2022-02-28 14:09:03
文章简介

精选8款纯CSS3搜索框前端样式,通用且美观。这些样式设计独特,既实用又时尚,无需JavaScript即可实现丰富的视觉效果。轻松为你的网站或应用增添亮点,提升用户体验,赶快尝试吧!

  • 正文开始
  • 相关阅读
  • 推荐作品

通用好看的8款纯CSS3搜索框前端样式

全部代码如下(最后提供了文件下载):

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>8款纯CSS3搜索框</title>

    <link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <style>
        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            padding: 0;
            background: #494A5F;
            font-weight: 500;
            font-family: "Microsoft YaHei","宋体","Segoe UI", "Lucida Grande", Helvetica, Arial,sans-serif, FreeSans, Arimo;
        }

        #container {
            width: 500px;
            height: 820px;
            margin: 0 auto;
        }
        div.search {padding: 30px 0;}

        form {
            position: relative;
            width: 300px;
            margin: 0 auto;
        }

        input, button {
            border: none;
            outline: none;
        }

        input {
            width: 100%;
            height: 42px;
            padding-left: 13px;
        }

        button {
            height: 42px;
            width: 42px;
            cursor: pointer;
            position: absolute;
        }

        /*搜索框1*/
        .bar1 {background: #A3D0C3;}
        .bar1 input {
            border: 2px solid #7BA7AB;
            border-radius: 5px;
            background: #F9F0DA;
            color: #9E9C9C;
        }
        .bar1 button {
            top: 0;
            right: 0;
            background: #7BA7AB;
            border-radius: 0 5px 5px 0;
        }
        .bar1 button:before {
            content: "f002";
            font-family: FontAwesome;
            font-size: 16px;
            color: #F9F0DA;
        }

        /*搜索框2*/
        .bar2 {background: #DABB52;}
        .bar2 input, .bar2 button {
            border-radius: 3px;
        }
        .bar2 input {
            background: #F9F0DA;
        }
        .bar2 button {
            height: 26px;
            width: 26px;
            top: 8px;
            right: 8px;
            background: #F15B42;
        }
        .bar2 button:before {
            content: "f105";
            font-family: FontAwesome;
            color: #F9F0DA;
            font-size: 20px;
            font-weight: bold;
        }

        /*搜索框3*/
        .bar3 {background: #F9F0DA;}
        .bar3 form {background: #A3D0C3;}
        .bar3 input, .bar3 button {
            background: transparent;
        }
        .bar3 button {
            top: 0;
            right: 0;
        }
        .bar3 button:before {
            content: "f002";
            font-family: FontAwesome;
            font-size: 16px;
            color: #F9F0DA;
        }

        /*搜索框4*/
        .bar4 {background: #F15B42;}
        .bar4 form {
            background: #F9F0DA;
            border-bottom: 2px solid #BE290E;
        }
        .bar4 input, .bar4 button {
            background: transparent;
        }
        .bar4 button {
            top: 0;
            right: 0;
        }
        .bar4 button:before {
            content: "f178";
            font-family: FontAwesome;
            font-size: 20px;
            color: #be290e;
        }

        /*搜索框5*/
        .bar5 {background: #683B4D;}
        .bar5 input, .bar5 button {
            background: transparent;
        }
        .bar5 input {
            border: 2px solid #F9F0DA;
        }
        .bar5 button {
            top: 0;
            right: 0;
        }
        .bar5 button:before {
            content: "f002";
            font-family: FontAwesome;
            font-size: 16px;
            color: #F9F0DA;
        }
        .bar5 input:focus {
            border-color: #311c24
        }

        /*搜索框6*/
        .bar6 {background: #F9F0DA;}
        .bar6 input {
            border: 2px solid #c5464a;
            border-radius: 5px;
            background: transparent;
            top: 0;
            right: 0;
        }
        .bar6 button {
            background: #c5464a;
            border-radius: 0 5px 5px 0;
            width: 60px;
            top: 0;
            right: 0;
        }
        .bar6 button:before {
            content: "搜索";
            font-size: 13px;
            color: #F9F0DA;
        }


        /*搜索框7*/
        .bar7 {background: #7BA7AB;}
        .bar7 form {
            height: 42px;
        }
        .bar7 input {
            width: 250px;
            border-radius: 42px;
            border: 2px solid #324B4E;
            background: #F9F0DA;
            transition: .3s linear;
            float: right;
        }
        .bar7 input:focus {
            width: 300px;
        }
        .bar7 button {
            background: none;
            top: -2px;
            right: 0;
        }
        .bar7 button:before{
          content: "f002";
          font-family: FontAwesome;
          color: #324b4e;
        }

        /*搜索框8*/
        .bar8 {background: #B46381;}
        .bar8 form {
            height: 42px;
        }
        .bar8 input {
            width: 0;
            padding: 0 42px 0 15px;
            border-bottom: 2px solid transparent;
            background: transparent;
            transition: .3s linear;
            position: absolute;
            top: 0;
            right: 0;
            z-index: 2;
        }
        .bar8 input:focus {
            width: 300px;
            z-index: 1;
            border-bottom: 2px solid #F9F0DA;
        }
        .bar8 button {
            background: #683B4D;
            top: 0;
            right: 0;
        }
        .bar8 button:before {
            content: "f002";
            font-family: FontAwesome;
            font-size: 16px;
            color: #F9F0DA;
        }
    </style>
</head>
<body>
<div id="container">
    <div class="search bar1">
        <form>
            <input type="text" placeholder="请输入您要搜索的内容...">
            <button type="submit"></button>
        </form>
    </div>

    <div class="search bar2">
        <form>
            <input type="text" placeholder="请输入您要搜索的内容...">
            <button type="submit"></button>
        </form>
    </div>

    <div class="search bar3">
        <form>
            <input type="text" placeholder="请输入您要搜索的内容...">
            <button type="submit"></button>
        </form>
    </div>

    <div class="search bar4">
        <form>
            <input type="text" placeholder="请输入您要搜索的内容...">
            <button type="submit"></button>
        </form>
    </div>

    <div class="search bar5">
        <form>
            <input type="text" placeholder="请输入您要搜索的内容...">
            <button type="submit"></button>
        </form>
    </div>

    <div class="search bar6">
        <form>
            <input type="text" placeholder="请输入您要搜索的内容...">
            <button type="submit"></button>
        </form>
    </div>

    <div class="search bar7">
        <form>
            <input type="text" placeholder="请输入您要搜索的内容...">
            <button type="submit"></button>
        </form>
    </div>

    <div class="search bar8">
        <form>
            <input type="text" placeholder="请输入您要搜索的内容...">
            <button type="submit"></button>
        </form>
    </div>
</div>
</body>
</html>

 

相关下载(已下载次)
关联内容: CSS3 搜索框 前端 样式
百度UEditor编辑器优化,关闭HTML标签自动替换,保持原始标签输出
« 上一篇 2021年07月17日
货源网自适应通用文章头部模板代码分享
下一篇 » 2022年03月08日
  • 苹果手机input样式优化,告别默认椭圆,美化界面新体验
    1884阅读0条评论22个赞
    想要摆脱苹果手机input的默认样式?那个椭圆外观确实不太美观。别担心,我们有办法!通过简单的CSS调整,您可以轻松清除这些默认样式,让您的input控件焕然一新,更符合您的设计风格。让您的网页界面更加美观大方!
  • 帝国CMS搜索返回页修改及不生效解决方案教程
    3842阅读0条评论113个赞
    帝国CMS更改搜索返回页面步骤及解决更改不生效方法:首先,进入后台管理系统,找到模板设置,编辑搜索结果的页面模板。按需修改后保存。若更改不生效,尝试清空缓存或强制刷新模板缓存。同时,检查模板文件是否被正确上传至服务器,并确保网站配置中已正确指定新模板路径。完成以上步骤,即可成功更改搜索返回页面并解决不生效问题。
  • 帝国CMS 7.2,动态标签调用搜索模板优化技巧
    4125阅读2条评论75个赞
    帝国CMS7.2搜索模板新增动态标签调用功能,可灵活定制搜索结果展示。该功能仅输出一条搜索结果,简化信息呈现,提升用户体验,助力网站内容优化与高效管理。
  • 前端图标CSS优化与跨域访问解决方案
    6540阅读0条评论81个赞
    前端采用奥森图标CSS,实现视觉效果的优化。针对跨域名访问问题,可配置CORS策略,允许指定来源的访问。通过合理设置access-control-allow-origin,实现跨域资源共享,提升网页的灵活性和互操作性。
  • 帝国CMS投稿,自动捕获并前端展示发布者IP地址技巧
    595阅读0条评论18个赞
    帝国CMS投稿功能强化:自动捕获发布者IP地址,并在前端实时展示。此方法不仅提升了网站内容管理的安全性,还有助于追踪投稿来源,为管理员提供便捷的管理体验。

如本文对您有帮助,就请墨鱼抽根烟吧!