根据交替行更改FullCalendar 5.7的颜色 - nth-Child的哪个元素?

发布于 2025-02-12 02:37:56 字数 701 浏览 1 评论 0原文

有关于此的帖子。我已经这样做了:(

.fc table tr td:nth-child(odd) {
    border-collapse: collapse;
    border-spacing: 0;
    background: rgba(240,240,247,1);
    font-size: 1em
}

也尝试了.fc-scrollgrid-都一样),

但由于TR在工作日之前,这给出了交替列而不是行的两种颜色。

因此,一篇文章(从5年前开始)表明

.fc-day-grid > div.fc-row:nth-of-type(even) {
    background: #CCC;
}

另外,您需要定位代表的一系列元素 排 - 它们不是桌子。他们在桌子里,有 其中更多的表,但行本身实际上是< div> s (当您检查日历的渲染html时,您可以看到这一点 使用您的浏览器工具)。

但是,当我在浏览器中查看浏览器中的这些事件时,我在那里看不到任何divs。我不知道要定位哪个要素才能使此元素起作用。

我正在尝试将其应用于Fullcalendar 5.7的“ Daygridmonth”(Daygridmonth)5.7

有什么想法吗? - 谢谢

There have been posts on this. I have done this:

.fc table tr td:nth-child(odd) {
    border-collapse: collapse;
    border-spacing: 0;
    background: rgba(240,240,247,1);
    font-size: 1em
}

(also tried with .fc-scrollgrid -- all the same)

but that gives the 2 colors on alternating columns, not rows, since the tr's go by weekday.

So one post (from 5 years ago) which suggests

.fc-day-grid > div.fc-row:nth-of-type(even) {
    background: #CCC;
}

says:

Also, you need to target the series of elements which represent
the rows - they are not a table. They're inside a table, and there are
more tables inside them, but the rows themselves are actually <div>s
(you can see this when you inspect the rendered HTML of the calendar
using your browser tools).

But when I look in the browser at these events in the browser, I don't see any divs in there. I don't know which element to target to get this to work.

I am trying to apply this to the month view (dayGridMonth) in fullCalendar 5.7

Any ideas? -- Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素手挽清风 2025-02-19 02:37:56

在FullCalendar 5.x中的DayGridMonth视图中,网格中的每一行都具有以下html:

<tr role="row">

它们在&lt; tbody prole =“呈现”&gt; table body元素(以将它们与其他区分开来&lt; tr&gt;,例如具有相同行的列标题行)。

通过使用浏览器的元素检查器工具查看日历生成的HTML,可以看到这一点。

因此,您可以用CSS规则将交替行定位为类似的内容:

.fc-dayGridMonth-view tbody[role=presentation] tr[role=row]:nth-child(odd)

demo: https://codepen.io noreferrer /adyson82/pen/mdxjypp

In the dayGridMonth view in fullCalendar 5.x, each row in the grid has the following HTML:

<tr role="row">

These are within a <tbody role="presentation"> table body element (to distinguish them from other <tr>s such as the column heading row, which have the same row).

This can be seen by looking at the calendar's generated HTML using a browser's element inspector tool.

So you can target the alternating rows with a CSS rule something like this:

.fc-dayGridMonth-view tbody[role=presentation] tr[role=row]:nth-child(odd)

Demo: https://codepen.io/ADyson82/pen/mdxJYpp

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文