当前位置: 首页 > 图文教程 > 网页制作 > CSS样式表 > css 教学实例 漂亮的搜索框

CSS样式表
做网页中需要掌握的八个CSS布局技巧
CSS属性 - white-space 空白属性使用说明
用CSS构建iframe效果代码
用div+css解决出现水平滚动条问题
ul在Firefox和IE下的不同表现的解决方法
用css实现隐藏文本框
css实现行间距效果
研究了一下div+css的高度自适应问题
做网页字体大小参考 网页中同字号字体的不同单位对比列表
css 之 background-position-x
css实现兼容各个浏览器的技巧的代码
css中的行间距的代码
HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth完全详解
scrollWidth,clientWidth与offsetWidth的区别
大家需要掌握的 html下SPAN和DIV的区别
布局用CSS+DIV的优点总结
纯CSS生成抗锯齿圆角的代码
IE6,IE7和firefox对DIV的支持区别
DIV+CSS布局的网站对网站SEO的影响分析
非常不错的关于IE与FireFox的js和css几处不同点[转自星火燎原]

CSS样式表 中的 css 教学实例 漂亮的搜索框


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-27   浏览: 1400 ::
收藏到网摘: n/a

如图:

我就身教一回,代码如下:

代码如下:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>css教学(学生:Dream·Sky)</title>
<style type="text/css">
.search{background:url(img/searchbg.jpg);width:250px;height:37px;}
/*这里之所以用两个div是为了解决float:left的时候,margin-left在ie与ff下的不同解析*/
.s_1{float:left;width:12px;}
.s_3{float:left;width:2px;}
.s_2{float:left;width:185px;}
.s_4{float:left;width:25px;}
.txt{width:170px;border:0;margin-top:8px;color:#CCCCCC;}
.btn{margin-top:5px;}
</style>
<script type="text/javascript">
function f(){
alert(document.getElementById("Text1").value);
}
</script>
</head>
<body>
<div class="search">
<div class="s_1">&nbsp;</div><!--这里需要加空格,否则火狐下无效-->
<div class="s_2">
<input id="Text1" type="text" class="txt" value='搜索我们的产品..' onclick="this.value='';" />
</div>
<div class="s_3">&nbsp;</div>
<div class="s_4"><input type="image" src="img/btnbg.jpg" class="btn" onclick="f();" /></div>
</div>
</body>
</html>

打包下载