如何使 React-Day-Picker 月份水平并排而不是垂直对齐
How to make React-Day-Picker months side by side horizontally instead of vertically aligned
我正在使用 react-day-picker 组件,我已经能够显示 2 个月,但它们在屏幕上显示的时间是一个接一个。我怎样才能将其更改为水平对齐?我尝试更改 CSS 并使用内联,但它不起作用。
Here is how it looks now
import React from 'react';
import DayPicker from 'react-day-picker';
import 'react-day-picker/lib/style.css';
export default function Example() {
return <DayPicker numberOfMonths={2} />;
}
您可以尝试将此添加到您的样式中:
.DayPicker-Months {
flex-direction: row;
flex-wrap: nowrap;
}
您可以在此处查看实际示例:https://codesandbox.io/s/react-day-picker-base-yledo
我正在使用 react-day-picker 组件,我已经能够显示 2 个月,但它们在屏幕上显示的时间是一个接一个。我怎样才能将其更改为水平对齐?我尝试更改 CSS 并使用内联,但它不起作用。
Here is how it looks now
import React from 'react';
import DayPicker from 'react-day-picker';
import 'react-day-picker/lib/style.css';
export default function Example() {
return <DayPicker numberOfMonths={2} />;
}
您可以尝试将此添加到您的样式中:
.DayPicker-Months {
flex-direction: row;
flex-wrap: nowrap;
}
您可以在此处查看实际示例:https://codesandbox.io/s/react-day-picker-base-yledo