简体   繁体   English

带有反应日期的 CSS 样式

[英]CSS Styling with react-dates

Hopefully a simple question with a simple answer, but how exactly do you use custom CSS to style react-date components?希望是一个简单的问题和一个简单的答案,但是您究竟如何使用自定义 CSS 来设置 react-date 组件的样式? The docs on Github are about as clear as mud to me when it comes to CSS and seems to push users to use the theme method...which seems like a perfect way to make my project even more messy and confusing.当谈到 CSS 时,Github 上的文档对我来说就像泥巴一样清晰,似乎促使用户使用主题方法……这似乎是使我的项目更加混乱和混乱的完美方式。 I understand that I have to import react-dates/initialize and react-dates/lib/css/_datepicker.css , but importing my own CSS does not seem to affect the styling.我知道我必须导入react-dates/initializereact-dates/lib/css/_datepicker.css ,但导入我自己的 CSS 似乎不会影响样式。 I am using the default create-react-app setup for my application.我正在为我的应用程序使用默认的 create-react-app 设置。

First you will need to include the libraries CSS and then include your custom CSS to override the libraries CSS.首先,您需要包含库 CSS,然后包含您的自定义 CSS 以覆盖库 CSS。

require("libraries/style.css"); // Make sure to include this before your custom css
require("custom/style.css");

In your custom style.css file, you will need to override the styling rules from style.css like so.在您的自定义 style.css 文件中,您需要像这样覆盖 style.css 中的样式规则。

.library-css-rule {
   color: #000;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM