Я пытаюсь использовать панель поиска css из пера кода. Я использовал их точный код, но панель поиска, похоже, действительно глючит.
Вот песочница кода для лучшего ознакомления. https://codesandbox.io/s/sad-moser-mdxmd?file=/src/Dashboard.js
Вот код, который я сейчас использую.
<div class = "wrap">
<div class = "search">
<input type = "text" class = "searchTerm" id = "input_text"></input>
<button type = "submit" class = "searchButton">
<i class = "fa fa-search"></i>
</button>
</div>
</div>
.search {
width: 100%;
position: center;
display: flex;
}
.searchTerm {
width: 100%;
border: 3px solid #00b4cc;
border-right: none;
padding: 5px;
height: 20px;
border-radius: 5px 0 0 5px;
outline: none;
color: #9dbfaf;
}
.searchTerm:focus {
color: #00b4cc;
}
.searchButton {
width: 40px;
height: 36px;
border: 1px solid #00b4cc;
background: #00b4cc;
text-align: center;
color: #fff;
border-radius: 0 5px 5px 0;
cursor: pointer;
font-size: 20px;
}
/*Resize the wrap to see the search bar change!*/
.wrap {
width: 30%;
position: flex;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Я хочу, чтобы панель поиска выглядела так: введите здесь описание изображения
Это ссылка на код, который я пытался использовать.
поскольку вы используете простой html, вы должны использовать здесь jsx. Используйте любой онлайн-конвертер jsx, например «https://magic.reactjs.net/htmltojsx.htm» и т. д. для этого вы можете использовать:
<div className = "wrap">
<div className = "search">
<input type = "text" className = "searchTerm" id = "input_text" />
<button type = "submit" className = "searchButton">
<i className = "fa fa-search" />
</button>
</div>
</div>