HTML/CSS 创建多搜索引擎搜索框 - Google, Bing, Yahoo
使用 HTML 和 CSS 创建多搜索引擎搜索框
你可以使用 HTML 和 CSS 来生成一个搜索框,并添加不同的搜索按钮,方便用户快速切换搜索引擎。以下是一个示例代码:
<!DOCTYPE html>
<html>
<head>
<style>
.search-container {
display: flex;
align-items: center;
justify-content: center;
margin-top: 50px;
}
.search-input {
width: 300px;
height: 30px;
padding: 5px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 5px;
outline: none;
}
.search-button {
margin-left: 10px;
padding: 5px 10px;
font-size: 16px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.search-button-google {
background-color: #4285f4;
color: #fff;
}
.search-button-bing {
background-color: #2a8ccb;
color: #fff;
}
.search-button-yahoo {
background-color: #6f42c1;
color: #fff;
}
</style>
</head>
<body>
<div class='search-container'>
<input type='text' class='search-input' placeholder='在这里输入搜索内容'>
<button class='search-button search-button-google'>Google</button>
<button class='search-button search-button-bing'>Bing</button>
<button class='search-button search-button-yahoo'>Yahoo</button>
</div>
</body>
</html>
这段代码会生成一个搜索框和三个搜索按钮,分别对应 Google、Bing 和 Yahoo 搜索引擎。你可以根据需要自定义按钮的样式和搜索引擎。
如何使用:
- 复制代码: 将上面的代码复制到你的 HTML 文件中。
- 修改样式: 可以根据你的需求修改 CSS 样式,例如颜色、字体大小、按钮形状等。
- 添加其他搜索引擎: 你可以添加更多搜索引擎按钮,并根据每个搜索引擎的 API 添加相应的 JavaScript 代码来实现搜索功能。
注意: 为了实现搜索功能,你需要将搜索按钮链接到相应的搜索引擎 API。你可以使用 JavaScript 来实现这一点。
希望这个示例可以帮助你创建一个多搜索引擎搜索框!
原文地址: https://www.cveoy.top/t/topic/QiS 著作权归作者所有。请勿转载和采集!