javaweb利用 css美化搜索界面给出具体代码
时间: 2023-07-14 08:14:07 浏览: 81
以下是一个简单的搜索界面的 HTML 和 CSS 代码示例:
HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>Search Page</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="search-container">
<form action="#" method="get">
<input type="text" placeholder="Search...">
<button type="submit">Search</button>
</form>
</div>
</body>
</html>
```
CSS代码:
```css
body {
background-color: #f2f2f2;
}
.search-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
form {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
}
input[type="text"] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: none;
border-radius: 4px;
background-color: #f2f2f2;
}
button[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
button[type="submit"]:hover {
background-color: #45a049;
}
```
这段代码会创建一个简单的搜索框,其中包括一个文本框和一个提交按钮。CSS 样式会使其看起来更美观,包括背景色、投影和按钮悬停效果。你可以将这些代码复制到你的项目中并进行修改,以适应你的需求。