🗣 SL提问: html搜索框美化
✍️ Ai批改: 要美化 HTML 搜索框,可以使用 CSS 来实现。以下是一个简单的示例代码,展示如何创建一个美观的搜索框:
html
<!DOCTYPE html
<html lang=en
<head
<meta charset=UTF-8
<meta name=viewport content=width=device-width, initial-scale=1.0
<title美化搜索框</title
<style
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: f0f0f0;
}
.search-container {
position: relative;
}
.search-box {
width: 300px;
padding: 10px 40px 10px 20px;
border: none;
border-radius: 25px;
font-size: 16px;
outline: none;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
}
.search-box:focus {
width: 350px;
}
.search-icon {
position: absolute;
right: 15px;
top: 50%;
transform: translateY(-50%);
color: aaa;
}
</style
</head
<body
<div class=search-container
<input type=text class=search-box placeholder=请输入搜索内容...
<span class=search-icon🔍</span
</div
</body
</html
说明:
1、HTML 结构:使用了一个 `div` 容器来包裹搜索框和图标。
2、CSS 样式:
`.search-container`:设置为相对定位,以便于绝对定位图标。
`.search-box`:设置输入框的宽度、内边距、边框圆角、字体大小等样式,并添加了阴影效果和过渡动画。
`.search-box:focus`:当输入框获得焦点时,宽度会增加,产生扩展效果。
`.search-icon`:使用绝对定位将图标放在输入框的右侧,并居中显示。
你可以根据需要进一步调整样式,例如颜色、字体、图标等,以满足你的设计需求。
0
IP地址: 213.32.30.53
搜索次数: 7
提问时间: 2025-06-17 13:04:33
❓️ 热门提问:
博时双月薪定期支付债券
黄金外汇储备
金渐层几号色最好
黄金制品哪个品牌好
博时裕景纯债债券B
ai聊天记录
人工智能ai和
.com.cn域名怎么注册
四川养老保险退休金怎么算的
5个9黄金多少钱一克今日金价
豌豆Ai站群搜索引擎系统
🤝 关于我们:
三乐Ai
作文批改
英语分析
在线翻译
拍照识图
Ai提问
英语培训
本站流量
联系我们
📢 温馨提示:本站所有问答由Ai自动创作,内容仅供参考,若有误差请用“联系”里面信息通知我们人工修改或删除。
👉 技术支持:本站由豌豆Ai提供技术支持,使用的最新版:《豌豆Ai站群搜索引擎系统 V.25.05.20》搭建本站。