学习记录
css样式
input[type=search]{
border:1px solid #ccc; /* 输入框边框 */
background:url("1.png") no-repeat left white ; /*背景 */
background-size: auto 100%; /*适应输入框*/
height: 30px;
text-align: center;
opacity: 0.7;
}
input[type=search]:focus{ /* 输入框focus事件*/
background:#eee ;
opacity: 1;
}
HTML
<label for="search">搜索:</label>
<input type="search" id="search" size="50px" placeholder="请输入"
onfocus="this.placeholder=''" onblur="this.placeholder='请输入' " >
/* onfocus 和onblur*/
具体效果


本文详细介绍如何使用CSS自定义HTML中的搜索框样式,包括边框、背景、透明度及焦点状态的效果。通过具体代码实例展示如何实现这些样式,并探讨不同浏览器的兼容性问题。

被折叠的 条评论
为什么被折叠?



