background image position
mpeaton37 opened this issue · 8 comments
You can use an override style if you cannot get it working with the existing themes. Check out my blog on custom themes for Marp.
https://www.ansiblejunky.com/blog/custom-themes-with-marp/
We're making a clean sweep of piled up issues. Filling entire slide in center is already a default behavior of background image ![bg]()
.
Certainly the inline image ![]()
might see like to be cropped and justified to left, but it have to contain "bg" keyword in alt to use as background.
Good to know, thanks for the tip.
It appears when I use ![bg]()
just after the ---
slide separator, the background uses the image but it has a low opacity. I assume you have some CSS in your themes that is doing that. I would prefer this to be controlled by the markdown author instead. Any way to control this in the current version?
@yubaoliu Use custom styling.
<style>
.slide {
background: #fff url(bg-image.jpg) no-repeat center center;
background-size: cover;
}
</style>
# Slide contents
Marp Next (Marpit) has already supported setting CSS background by backgroundImage
directive. Use it in front matter to set background for all slides:
---
backgroundImage: url(bg-image.jpg)
---
# Slide contents
The custom styling still can use in Marp Next.
<style>
section {
background: #fff url(bg-image.jpg) no-repeat center center;
background-size: cover;
}
</style>
# Slide contents
Thanks, I tried this. It works after I remove <!-- $theme: gaia -->
. It seems like I need to use a custom theme.