首页 话题 小组 问答 好文 用户 我的社区 域名交易 唠叨

[分享]css3搜索条代码

发布于 2024-11-11 15:45:56
0
13

CSS3 搜索条是一个非常炫酷的特效,在网站的设计中经常使用。下面给大家介绍一下如何实现 CSS3 搜索条。

/* CSS3 搜索条 */
.search-bar {
    position: relative;
    width: 250px;
    margin: 20px auto;
}

.search-input {
    width: 100%;
    padding: 8px 10px;
    border: none;
    font-size: 16px;
    border-radius: 50px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

.search-button {
    position: absolute;
    top: 0;
    right: 0;
    height: 40px;
    width: 40px;
    background: #fff;
    border: none;
    border-radius: 50%;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    cursor: pointer;
}

.search-button:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 20px;
    width: 20px;
    border: 2px solid #333;
    border-top: none;
    border-right: none;
    transition: all 0.3s ease-in-out;
}

.search-button:hover:before {
    transform: translate(-50%, -50%) rotate(45deg);
} 

代码含义:这是 CSS3 实现的搜索条代码。包含了搜索文本框和搜索按钮两个主要元素。具体代码请查看上述代码的注释。

评论
一个月内的热帖推荐
91云脑
Lv.1普通用户

62849

帖子

14

小组

291

积分

赞助商广告
站长交流