给搜索框加上红色边框
时间: 2023-07-08 12:10:52 浏览: 217
你只需要在 `.search-box input[type="text"]` 的样式中加上 `border: 2px solid red;` 就可以给搜索框加上红色边框。代码如下:
```html
<div class="container">
<div class="image-box">
<img src="your-image-url" alt="your-image-alt">
</div>
<div class="search-box">
<input type="text" placeholder="请输入您要搜索的功能">
</div>
</div>
<style>
.container {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.image-box {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
width: 20%;
}
.image-box img {
max-width: 100%;
height: auto;
}
.search-box {
flex: 4;
display: flex;
align-items: center;
justify-content: center;
width: 80%;
}
.search-box input[type="text"] {
width: 100%;
padding: 10px;
border: none;
border-radius: 4px;
font-size: 16px;
color: #333;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
text-align: center;
border: 2px solid red;
}
.search-box input[type="text"]::placeholder {
color: #999;
}
</style>
```
这段代码中,我在 `.search-box input[type="text"]` 的样式中加上了 `border: 2px solid red;`,即给搜索框加上了2像素宽度、红色的边框。
阅读全文