【发布时间】:2021-07-06 15:13:57
【问题描述】:
如何禁用默认的 react-select 样式?
react-select 不在容器的中心,这就是为什么我必须使用margin-bottom,但这不是一个好的解决方案。
没有边距底部:
without margin-bottom
css
.header {
height: 98px;
display: flex;
justify-content: space-between;
background-color: #222968;
align-items: center;
padding: 0 10px;
}
.header__title {
font-weight: 700;
color: white;
}
.header__select{
height: 64px;
width: 169px;
margin-bottom: -30px;
}
脚本:
import * as React from 'react';
import Select from 'react-select';
const options = [
{ value: 'userName', label: 'username' },
{ value: 'logout', label: 'logout' },
]
export class Header extends React.Component {
render() {
return (
<div className='header'>
<span className='header__title'>Task Assistant Service</span>
<Select
className='header__select'
options= {options}
/>
</div>
);
}
}
【问题讨论】:
标签: javascript html css reactjs typescript