CSS3搜索框样式代码
/* 搜索框样式 */
.search-box {
width: 300px;
height: 40px;
position: relative;
margin: 20px auto;
}
/* 搜索框输入样式 */
.search-box input[type="text"] {
width: 100%;
height: 100%;
border: none;
background-color: #F5F5F5;
border-radius: 20px;
padding: 0 20px;
font-size: 14px;
}
/* 搜索按钮样式 */
.search-box button[type="submit"] {
position: absolute;
top: 0;
right: 0;
width: 40px;
height: 40px;
border: none;
background-color: #FFA500;
color: #fff;
border-radius: 20px;
font-size: 14px;
cursor: pointer;
outline: none;
transition: all .3s ease-in-out;
}
/* 鼠标移入时的搜索按钮样式 */
.search-box button[type="submit"]:hover {
background-color: #FFC269;
}
/* 鼠标点击时的搜索按钮样式 */
.search-box button[type="submit"]:active {
transform: scale(.95);
} 以上就是CSS3搜索框样式代码的实现方法,可以在项目中使用这些样式,让你的搜索框更美观、易用。