只用css和html的知识仿写一个必应搜索的页面,包括html代码和css代码
时间: 2024-05-15 15:14:15 浏览: 128
以下是基于必应搜索页面的HTML代码和CSS代码:
HTML代码:
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bing Search</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<a href="#" class="logo">
<img src="https://www.bing.com/sa/simg/bing_p_rr_teal_min.ico" alt="Bing Logo">
</a>
<form action="#" method="GET">
<input type="text" name="q" id="search-box" placeholder="Type your search query here...">
<button type="submit" id="search-btn">Search</button>
</form>
</header>
<main>
<section id="search-results">
<h2>Search Results</h2>
<ul>
<li>
<h3><a href="#">Result Title</a></h3>
<p>Result Description</p>
</li>
<li>
<h3><a href="#">Result Title</a></h3>
<p>Result Description</p>
</li>
<li>
<h3><a href="#">Result Title</a></h3>
<p>Result Description</p>
</li>
<li>
<h3><a href="#">Result Title</a></h3>
<p>Result Description</p>
</li>
<li>
<h3><a href="#">Result Title</a></h3>
<p>Result Description</p>
</li>
</ul>
</section>
<aside>
<section id="related-searches">
<h2>Related Searches</h2>
<ul>
<li><a href="#">Related Search 1</a></li>
<li><a href="#">Related Search 2</a></li>
<li><a href="#">Related Search 3</a></li>
<li><a href="#">Related Search 4</a></li>
<li><a href="#">Related Search 5</a></li>
</ul>
</section>
<section id="ads">
<h2>Ads</h2>
<a href="#">
<img src="https://via.placeholder.com/300x250" alt="Advertisement">
</a>
</section>
</aside>
</main>
<footer>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Privacy Policy</a></li>
</ul>
</nav>
</footer>
</body>
</html>
```
CSS代码:
```
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
color: #333;
}
header {
background-color: #f0f0f0;
padding: 20px;
display: flex;
align-items: center;
}
.logo img {
height: 40px;
}
form {
margin-left: auto;
display: flex;
align-items: center;
}
#search-box {
padding: 10px;
border-radius: 5px;
border: none;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}
#search-btn {
padding: 10px;
border-radius: 5px;
background-color: #0078d7;
color: #fff;
border: none;
margin-left: 10px;
cursor: pointer;
transition: background-color 0.3s ease;
}
#search-btn:hover {
background-color: #005a9e;
}
main {
display: flex;
margin-top: 20px;
}
#search-results {
flex: 3;
padding: 20px;
}
#search-results h2 {
margin-bottom: 20px;
}
#search-results ul {
list-style: none;
}
#search-results li {
margin-bottom: 20px;
}
#search-results li h3 {
margin-bottom: 5px;
}
#search-results li p {
color: #666;
}
aside {
flex: 1;
padding: 20px;
background-color: #f0f0f0;
}
#related-searches h2,
#ads h2 {
margin-bottom: 20px;
}
#related-searches ul,
#ads a {
color: #666;
}
#related-searches ul li,
#ads a {
margin-bottom: 10px;
display: block;
}
#related-searches ul li a:hover,
#ads a:hover {
color: #0078d7;
}
footer {
background-color: #f0f0f0;
padding: 20px;
margin-top: 20px;
}
footer ul {
list-style: none;
display: flex;
justify-content: space-between;
}
footer ul li {
margin-right: 20px;
}
footer ul li:last-child {
margin-right: 0;
}
```
阅读全文