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

CSS样式表
用CSS实现鼠标单击特效
引入CSS样式的五种方式
用CSS实现文字变图象特效
expression将JS、Css结合起来
alt属性和title属性
CSS使用技巧20则
CSS重新定义项目符号和编号技巧
CSS编辑工具Topstyle轻松打造网页风格
深入探讨CSS中字体元素
CSS经典实用技巧18招
FCKeditor 实战技巧
China.com网站开发规范
小三角的做法与使用
网站首页head区代码规范
动态更改网页HTML元素(对象)内容
css静态滤镜 + A:Hover
解读absolute与relative
怎样管理好样式
2006.12.06更新 TopStyle剪辑库
又一个典型css实例

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-27   浏览: 1380 ::
收藏到网摘: 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>

打包下载