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

CSS样式表
提高网页效率的14条注意事项图文
提高网页的效率 Use YSlow to know why your web Slow
学习WEB标准总结的一些CSS/XHTML知识小结
CSS文件可维护、可读性提高指南
Firefox下样式设置宽度奇怪现象
Chrome的hack写法以及CSS的支持程度图示
IE6支持position:fixed完美解决方法
css为图片设置背景图片
ASP、PHP与javascript根据时段自动切换CSS皮肤的代码
css图片切换效果代码[不用js]
css import与link的区别
BS项目中的CSS架构_仅加载自己需要的CSS
div结合css布局bbs首页(div+css布局入门)
css 兼容性问题this.style.cursor=''''hand''''
CSS渐变统计柱形图
跨浏览器的实践:position:fixed 层的固定定位
标准布局常见问题及解决办法
css美化input file按钮的代码方法
重置默认样式 css reset
支持IE6 IE7 Firefox 的纯CSS的下拉菜单

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


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

打包下载