无法使用类名将 Css 样式应用于反应日期时间



我正在尝试使用类名将边框半径:5px添加到反应日期时间组件中,但不起作用。

例如:

import ReactDateTime from ‘react-datetime’;
<ReactDateTime className=‘datetime’ />
.datetime{
border-radius: 5px;
}

我知道反应日期时间模块提供了单独的 css 样式。但我担心的是为什么当我使用 className 时它不接受。

尝试将inputProps与className一起使用,如下所示。它应该有效。

<DateTime inputProps={{className:'datetime'}} />

您是否尝试添加!important例如:

.datetime{
border-radius: 5px !important;
}

如果它不起作用,则可能是覆盖问题。

您可能需要在此处检查: https://github.com/YouCanBookMe/react-datetime/blob/master/example/react-datetime.css

如果它不起作用,我们可以看到您对此软件包的配置吗? 我们需要查看您的完整组件和 css 样式表

最新更新