Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在做一个日历,我想在标题图标上显示当天的数字,类似于whatsapp web 所做的事情(它显示您拥有的未读消息的数量)。如果有人知道怎么做,我会非常感激
最佳实践是使用 JavaScript 并动态呈现图标。
但是如果你还没有学过 JavaScript,你可以只学 CSS,但这有点棘手。您需要使用 nth-child CSS 伪类,然后使用 ::before 或 ::after 标签来放置图标或表情符号,以便更轻松。
.day:nth-child(7n+1)::before { content: 'monday'; }
:nth-child(7n +1) 表示每 7 个元素为第一个索引。您最多可以上 7 次,这样您就可以在一周中的每一天都覆盖