html - 如何在 Marp 或 Marpit 中对齐文本标题下方的图像
问题描述
我正在通过 VScode 使用 Marpit。这是 mi 最小工作示例:
---
marp: true
---
This should go in to the header and picture should be bellow it, but right now it is the middle of the picture
![bg contain](https://csgeekshub.com/wp-content/uploads/2020/07/C-Program-compilation-steps-and-process.jpg)
此代码的问题在于它会生成幻灯片,其中文本和图像与中心对齐,如下图所示:
我想将文本作为标题而不是交叉图像。
我怎样才能做到这一点?
解决方案
在 Marpit 中,您有一个启用基本图像修改的图像语法。在许多情况下,适合缩放图像而不是将其置于背景中。对于标题,您通常使用领先的主题标签。考虑以下
---
marp: true
theme: default
style: |
img[alt~="center"] {
display: block;
margin: 0 auto;
}
---
## A Beautiful Headline
![w:500 center](https://csgeekshub.com/wp-content/uploads/2020/07/C-Program-compilation-steps-and-process.jpg)
我在其中添加center
了水平对齐图像,从而产生了这张幻灯片:
这是一个品味问题,但我倾向于将justify-content
标题放在顶部
---
marp: true
theme: default
style: |
section{
justify-content: flex-start;
}
---
## A Beautiful Headline
- some valid point
- another interesting fact
- even more convincing
![bg right:50% w:500](https://csgeekshub.com/wp-content/uploads/2020/07/C-Program-compilation-steps-and-process.jpg)
因为它为信息性文本留出了空间,如下所示
推荐阅读
- python - 如何在python中几个文件的某些行的末尾添加一个字符串
- scala - 运行 scala 程序集 fat jar 时“找不到数据源:json”
- typeerror - (Python 3.8) TypeError: 'module' object is not callable
- javascript - 如何在 openlayers 中编辑点对象?
- linux - curl (56) Recv failure: Connection reset by peer with a simple docker run
- vue.js - 为什么我在 webpack-dev-server 重新编译时收到“.vue”文件的“找不到模块...”Typescript 错误?
- r - 比较两个数据帧的两列并找到未匹配项
- python - Python 3.7 和 PyCharm 的动态导入警告
- python - 如何在h5文件中打印文件夹名称
- javascript - 如何使用节点 js 在 vimeo 中上传文本轨道