HTML/CSS实现的搜索框

谷歌和百度首页的搜索框都是<input>+<button>模式的,bing的搜索框感觉要好点儿。简言之,就是将提交按钮放到<input>中,其实这是做不到的,只能伪装。
?1. [代码]主要源代码     
<html>
  
<head>
<title>掬一捧|搜索框的实现</title>
<meta charset="UTF-8">
<style type="text/css">
<!--
body {
    font-family:‘Lucida Sans Unicode‘, ‘Lucida Grande‘, sans-serif;
    font-size:14px;
}
 
h1 {
    margin-top:0px;
    margin-bottom:8px;
}
 
/* 链接 */
a {
    text-decoration:none;
    color:#1c00ff;
}
 
a:hover {
    color:#5f00e4;
}
fieldset.search {
    padding: 0px;
    border: none;
    width: 232px;
    background:#e0e0e0;
}
 
fieldset.search:hover {
    background: #a8a8a8;
}
.search input, .search button {
    border: none;
    float: left;
}
.search input.box {
    height: 28px;
    width: 200;
    margin-right: 0px;
    padding-right: 0px;
    background: #e0e0e0;
    margin: 1px;
}
.search input.box:focus {
    background: #e8e8e8 ;
    outline: none;
}
.search button.btn {
    border: none;
    width: 28px;
    height: 28px;
    margin: 0px auto;
    margin: 1px;
    background: url(http://sandbox.runjs.cn/uploads/rs/339/livk7pl5/search_blue.png) no-repeat top right;
}http://www.huiyi8.com/hunsha/chuangyi/?
.search button.btn:hover {创意婚纱照片
    background: url(http://sandbox.runjs.cn/uploads/rs/339/livk7pl5/search_black.png) no-repeat bottom right;
}
 
/* 文章样式 */
.article {
 
}
-->
</style>
</head>
<body>
<div>
<h2>搜索框</h2>
<form method="get" id="searchform" action="http://blog.iliyang.cn/">
    <fieldset class="search">
         <input type="text" class="box" name="s" id="s" class="inputText" placeholder="掬一捧" x-webkit-speech>
          <button class="btn" title="SEARCH"> </button>
    </fieldset>
</form>
</div>
<article class="article">
</article>
</body>
</html>
?

时间: 2024-07-30 00:44:52

HTML/CSS实现的搜索框的相关文章

css实现可伸缩的搜索框

效果图: 代码: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>可伸缩搜索框demo</title> </head> <body> <style type="text/css">

CSS搜索框

<title>CSS搜索框</title> <style type="text/css"> .searchinput{ border-right-width: 0px; padding-left: 3px; width: 168px; font-family: arial; float: left; border-top-width: 0px; border-bottom-width: 0px; color: #636365; margin-left

html css 模仿小米官网搜索框

写网页效果,掌握html,css,唯一的捷径就是多模仿,多练习.小米官网的搜索框效果看似简单,实际写代码的时候才发现要掌握好多css知识才能完成效果.浮动.导航条.鼠标经过.定位.文字框效果实现.js效果实现等等.下面这段代码仅仅用html.css写出了基本的样子,js效果,鼠标经过.点击事件,光标定位效果都还没有实现. 效果原图见小米官网:http://www.mi.com 搜索效果切换图: 最终效果: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1

图片轮播(bootstrap)与 圆角搜索框(纯css)

1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 6 <meta name="viewport" content="width=device-width, initial

模糊查询(类似百度搜索框)

很常见的搜索框,很常用,总结一下,怕自己忘了,使用的是原生的js. 这是原生写的,代码很简单,重要是思路.主要就是用了一个indexOf(),很简单.越简单的东西越难想到,很多人都会想到用正则去做,这样就舍近求远了. html部分: <div id="box"> <input type="text" id="txt" value = ""> <input type="button&quo

模拟百度搜索框,输入时显示历史记录

今天写了个小demo,利用本地存储的特点,模拟百度搜索框. 主要知识是利用本地存储的特点,模拟百度搜索时的历史记录显示. 主要HTML代码为 <div class="search"> <input type="text"/> <button class="btn">搜索</button> </div> <ul class="hidden"> <li&

【html】【21】高级篇--搜索框

下载: http://www.xwcms.net/js/bddm/25368.html 代码: 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"

【转】如何建立一个样式新颖的CSS3搜索框

在线演示 搜索框大概是web开发中最常用的UI元素之一,我想基本没有必要去介绍如何使用它.无论是网站还是web应用,都会为了增强用户体验而添加它,那么你是不是也想过设计一个别致的搜索框? 在今天的文章中,大家将会学到如何使用伪元素来创建一个超酷的CSS3搜索框.当然在开始介绍前你也可以下载源代码或者查看在线演示. HTML举例: 正如接下来你所看到的,标记很少,并且很容易理解: <form class=“cf form-wrapper”> <input type=“text” place

带分类页签搜索框的实现

需求:类似于淘宝搜索框,可以根据选择不同的分类进行帅选查询,效果图如下: aspx代码如下: <div id="divSearch" class="form-wrapper"> <div class="tab_area"> <div id="divWaterMeterCode" class="tab hover"><span onclick="setSea