我想把一些幻灯片倒过来.值得注意的是,我想要1级幻灯片(这些幻灯片默认有<h1>个1级标题)反转 colored颜色 :例如,白色和黑色.

这可以通过以下方式实现:

  1. 定义一个类.inverse,并且
  2. 在幻灯片页眉中指定背景 colored颜色 和.inverse

例如,在与演示文稿关联的style.scss文件中包括以下内容:

.inverse h1 {
   color: white;
 }

并使用以下方法使幻灯片反转

# Level 1 header {.inverse background-color="black"}

这很管用.然而,它需要一个手动指定的背景和每个幻灯片的类别,我想要颠倒.有没有一种全局设置的方法,使大括号中的内容不是必需的,并且所有级别1的幻灯片都会自动反转?

推荐答案

您可以使用Pandoc Lua filters自动使用inverse类,将background-color="black"用于所有级别1标头.

MWe

---
title: "Level 1 header"
format: revealjs
keep-md: true
filters: [bg_style.lua]
---

```{css, include=FALSE}
.inverse h1 {
   color: white;
 }
```


## Quarto

Quarto enables you to weave together content and executable code into a finished presentation. To learn more about Quarto presentations see <https://quarto.org/docs/presentations/>.

# Level 1 header

## Bullets

When you click the **Render** button a document will be generated that includes:

-   Content authored with markdown
-   Output from executable code

# Level 1 header

## Code

When you click the **Render** button a presentation will be generated that includes both content and the output of embedded code. You can embed code like this:

```{r}
1 + 1
```

bg_style.lua

function Header(el)
    if el.level == 1 then
      table.insert(el.classes, "inverse")
      el.attributes["data-background-color"] = 'black'
      return el
    end
end

inverse slide for level 1 header

Css相关问答推荐

在菜单中最后一项之后排除MUI分隔符

圆形按钮边框长度动画

如何使按钮:之后像按钮:之前一样可见

flex-wrap 导致 children 身高加倍

如何在不使用 !important 的情况下提高优先级?

网格在行方向上的大小不正确

使用 CSS 填充悬停过渡的闪烁文本问题

如何在 Angular 中使用 CSS 设置 FontAwesome 图标的大小?

从 Angular SCSS 生成 CSS?

纯 CSS/JS 的 SVG 连续向内方形螺旋动画

滚动到该 div 后如何使 div 固定?

使用 JavaScript 将 CSS 添加到 ?

找到第一个可滚动的父级

在 IE9-10 中压缩 SVG 的背景大小

悬停效果:展开底部边框

通过javascript删除或禁用浏览器的焦点边框

仅使用 CSS 交换 DIV 位置

CSS垂直对齐不适用于浮动

CSS(webkit):在绝对定位元素上用底部覆盖顶部

html元素(div)的全高,包括边框,填充和边距?