css搜索框的代码怎么写(css中虚线代码怎么写)
admin 发布:2022-12-20 00:29 192
本篇文章给大家谈谈css搜索框的代码怎么写,以及css中虚线代码怎么写对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、css+div中搜索框怎么写
- 2、搜索框css样式
- 3、CSS搜索框样式
- 4、怎么写搜索框中的代码啊?
css+div中搜索框怎么写
.search/*整个搜索框*/{
width:300px;
height:30px;
background-image: url(../images/search.gif)/*这是这个搜索框的背景*/;
background-repeat: no-repeat;
background-position: 50%;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 15px;
padding: 0px;
overflow: hidden;
clear: both;
}
.search input/*用来去掉搜索框里的文本框和按钮的背景和边框,并设置并列排放*/{
border:none;
background:none;
float:left;
}
.search_box/文本框样式/{
width:150px;
height:26px;
line-height:26px;
padding:0px;
color:#999999;
text-align:left;
margin-top: 2px;
margin-right: 15px;
margin-bottom: 0px;
margin-left: 10px;
float: left;
}
.search_button/*按钮样式*/{
width:45px;
height:27px;
cursor:pointer;
color:#000000;
font-size: 14px;
}
具体样式可根据自己的需要调整。
希望对你有所帮助。
搜索框css样式
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
html xmlns="
head
meta http-equiv="Content-Type" content="text/html; charset=utf-8" /
title无标题文档/title
script type="text/javascript" src="jquery.js"/script
style
.{ padding:0; margin:0; list-style:none;}
.htmlBox{ width:100%; min-width:500px; height:500px; border:1px solid #A349A4; border-radius:5px;}
.sskBox{ width:100%; height:35px; margin-top:150px; border:1px solid #000; border-left:0; border-right:0;}
.zc{ width:100px; height:35px; float:left;}
.zj{ width:250px; height:35px; float:left; border-left:1px solid #000; border-right:1px solid #000;}
.yc{ height:35px; float:right;}
/style
/head
body
div class="htmlBox"
div class="sskBox"
div class="zc"左边100/div
div class="zj"中间250/div
div class="yc"右边自适应/div
/div
/div
/body
script
tmntH();//加载的时候执行一次
$(window).resize(function() {tmntH();});//浏览器窗口变化时执行
function tmntH()
{
var ycw=$(".sskBox").width()-352+'px';//yc的宽度等于sskBox宽度-350-2(边框线)
//alert(div3);
$(".yc").css("width",ycw);
}
/script
/body
/html
CSS搜索框样式
这个搜索框做的很好,看似简单,里面包含了大量CSS基础知识。由于时间关系,这里写了一个相似度为95%的样式供参考和学习,由于无法确认字体,先挑选了比较接近的Gautami
先上HTML
body
div id="A"
input id="inputTxt" type="text" placeholder="Search" /
div id="inputBtn"Go/div
/div
/body
这里开始写CSS
body { padding: 0; margin: 0; background: #D6D6D6; }
/*固定容器*/
#A { width: 316px; height: 28px; margin: 22% auto; border: 1px solid #A3A3A3; border-top-color: #939393; border-bottom-color: #D5D5D5; border-radius: 3px; box-shadow: 0px 1px 1px #f4f4f4; position: relative; }
#A * { position: absolute; top: 0; }
/*输入框*/
#inputTxt { left: 0; width: 246px; height: 24px; background: #E6E6E6; border: 0; border-top: 1px solid #C8C8C8; border-bottom: 1px solid #E6E6E6; outline: none; padding-left: 30px; color: #666; }
#inputTxt::-webkit-input-placeholder,#inputTxt::-moz-placeholder { color: #B8B8B8; font: 600 13px 'Gautami'; }
/*按钮*/
#inputBtn { right: 0; width: 38px; height: 26px; line-height: 26px; background: linear-gradient(#E4E4E4, #B5B5B5); border: 1px solid transparent; border-top-color: #FCFCFC; border-left-color: #ADADAD; border-bottom-color: #B5B5B5; color: #6E6E6E; text-align: center; font-size: smaller; font-weight: bold; cursor: pointer; }
/*文字阴影*/
#inputTxt, #inputBtn, #inputTxt::-webkit-input-placeholder,#inputTxt::-moz-placeholder { text-shadow: 1px 1px 0px #fff; }
/*图标*/
#A:before, #A:after { content: ""; position: absolute; z-index: 2; box-shadow: 0px 1px 0px #fff; }
#A:before { left: 9px; top: 9px; width: 6px; height: 6px; border: 2px solid #ccc; border-radius: 50%; }
#A:after { left: 17px; top: 18px; width: 6px; height: 2px; background: #ccc; transform: rotate(45deg); -webkit-transform: rotate(45deg); -o-transform: rotate(45deg); }
最后,上效果图:上为原始搜索框,下为本次代码实现的搜索框
怎么写搜索框中的代码啊?
首先把搜索宽切片下来再CSS样式里面用为背景
body
form action="" method="get"
div class="kuan"input name="" type="text" //div!--搜索框--
div class="an"input name="" type="button" //div!--搜索按钮版--
/form
/body
CSS样式根据实际权自己调整
style type="text/css"
.kuan input{ width:330px; height:60px; background:background:url(../img/kuan_01.jpg) no-repeat; border:none; float:left}
.an input{ width:120px; height:60px; background:background:url(../img/an_02.jpg) no-repeat;border:none; float:left}
/style
css搜索框的代码怎么写的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于css中虚线代码怎么写、css搜索框的代码怎么写的信息别忘了在本站进行查找喔。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
- 上一篇:网易在线代码编辑器(易语言代码编辑器)
- 下一篇:源代码解密(源代码加密软件)
相关推荐
- 05-20优化百度搜索结果怎么看,优化百度搜索结果怎么看不了
- 05-20如何点击优化神马排名软件,神马搜索怎么优化
- 05-19百度搜索排名,百度搜索排名与点击有关吗
- 05-19百度浏览器,百度浏览器历史记录怎么恢复
- 05-19seo关键词搜索和优化,搜索引擎关键词优化机构
- 05-19免费关键词搜索工具,关键词搜索平台
- 05-19百度搜索排名,百度搜索排名优化推广路径
- 05-19怎么免费创建网站,怎么免费创建自己的网站平台
- 05-19现在的网络推广怎么做,网络怎样做推广
- 05-19怎么在百度上发帖推广,免费百度广告怎么投放
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接