英文:
How do I modify the font family and border color of my search bar in HTML and CSS?
问题
以下是您要翻译的内容:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
.searchInput::-webkit-input-placeholder {
font-family: FontAwesome;
font-weight: normal;
overflow: visible;
vertical-align: top;
display: inline-block !important;
padding-left: 2%;
padding-top: 1%;
color: #9D9494;
}
.searchInput {
border: 1px solid white;
border-radius: 5px;
width: 39%;
height: 5%;
padding: 0px;
font-size: 20px;
margin-left: 60%;
margin-top: 2%;
margin-bottom: 5%;
}
<!-- language: lang-html -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"/>
<input class="searchInput" type="text" placeholder="  search " /><br />
<!-- end snippet -->
请注意,这是您提供的HTML和CSS代码,已经按原样呈现出来。如果您需要任何翻译或进一步的帮助,请随时提问。
英文:
hello i need to make a serach bar it works for me but i have some modification to do what i aim to do is when i click on the bar search i want to change the color of border from black to blue .. besides how can i change the font family of the word search !
this my html and css code thanks in advice !
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
.searchInput::-webkit-input-placeholder {
font-family: FontAwesome;
font-weight: normal;
overflow: visible;
vertical-align: top;
display: inline-block !important;
padding-left: 2%;
padding-top: 1%;
color: #9D9494;
}
.searchInput {
border: 1px solid white;
border-radius: 5px;
width: 39%;
height: 5%;
padding: 0px;
font-size: 20px;
margin-left: 60%;
margin-top: 2%;
margin-bottom: 5%;
}
<!-- language: lang-html -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"/>
<input class="searchInput" type="text" placeholder=" &#61442; search " /> <br />
<!-- end snippet -->
答案1
得分: 1
可以使用:focus选择器来在点击搜索栏时更改边框颜色。如果你想要更改占位符字体系列,可以使用:placeholder选择器。
例如:
.searchInput:focus {
border-color: blue;
}
.searchInput:placeholder {
font-family: "Open-sans";
}
英文:
You can use the :focus selector to change the border color when you click on the search bar. If you want to change the placeholder font family, you can use the :placeholder selector.
for eg:
.searchInput:focus {
border-color: blue;
}
.searchInput:placeholder{
font-family: "Open-sans";
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论