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

CSS样式表
CSS Sprite的一些最佳实践方法
绝对定位(absolute)和浮动定位(float)分析
IE 选择符的4095限制
CSS IE6奇数宽度或高度的bug
CSS Border属性制作小三角
清理CSS样式的几个有用工具
IE7 position:relative的问题
CSS 网页布局中易犯的10个小错误小结
纯CSS搞定按钮、链接点击时的虚线
CSS经典技巧十则
CSS超级技巧大放送合集
漂亮的表格
首届世界CSS设计大赛结果揭晓
HTML表单元素覆盖样式元素问题及其补救之道
网页美工制作规范
top、clientTop、scrollTop、offsetTop
双表法调用样式表
典型的三行二列居中高度自适应布局
用!important解决IE和Mozilla的布局差别
CSS hack浏览器兼容一览表

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


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

打包下载