制作百度首页搜索栏的布局代码
时间: 2024-03-14 12:43:29 浏览: 16
下面是一个制作百度首页搜索栏布局的示例代码:
```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>百度首页</title>
<style>
.header {
height: 80px;
background-color: #fff;
border-bottom: 1px solid #ebebeb;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
width: 120px;
height: 60px;
background-image: url(logo.png);
background-repeat: no-repeat;
background-size: contain;
}
.search {
width: 500px;
height: 42px;
background-color: #f5f5f5;
border: 1px solid #ebebeb;
border-radius: 20px;
display: flex;
align-items: center;
padding: 0 20px;
}
.search-input {
flex: 1;
border: none;
background: none;
outline: none;
font-size: 16px;
}
.search-btn {
width: 80px;
height: 42px;
background-color: #3385ff;
border: none;
border-radius: 20px;
color: #fff;
font-size: 16px;
cursor: pointer;
margin-left: 10px;
}
</style>
</head>
<body>
<header class="header">
<div class="logo"></div>
<form class="search">
<input class="search-input" type="text" placeholder="请输入搜索内容">
<button class="search-btn" type="submit">搜索</button>
</form>
</header>
</body>
</html>
```
在上面的代码中,我们使用了Flex布局来实现头部的对齐,搜索框使用了圆角边框和阴影效果,搜索按钮使用了蓝色背景和白色文字。该布局可以在PC和移动设备上都有良好的表现。