Closed sctyner closed 6 years ago
I think contain
is a better option for background-size
in your case:
background-size: contain;
background-position: 0 0;
See https://www.w3schools.com/cssref/css3_pr_background-size.asp
BTW, you can (and should) partially override xaringan's default CSS instead of fully copying the whole thing and adding a few lines of CSS in it: https://slides.yihui.name/xaringan/#36 The YAML setting would look like this:
output:
xaringan::moon_reader:
css: [default-fonts, default, primary.css]
where primary.css
only contains your .primary
CSS rules.
And also BTW, you may check out the four-backtick rule for how to post valid Rmd examples in Github issues instead of using the awkward \```
:)
background-size: contain;
background-position: 0 0;
was the solution. Thanks!
The whole shebang contains multiple CSS files but just did that for minimally repro example. :)
And, I totally forgot about the four-backtick rule. Thanks again. 👍 (@srvanderplas)
Hi @yihui,
I'm loving xaringan for making a new slide template instead of using powerpoint or beamer at work. But, I'm running into issues.
Background
What I'm attempting to do is create slide types (in the example, class
.primary
, and in my work I also have a type.secondary
) and use those to style slides. e.g.I take the powerpoint master background as the background image. The css that differs from
default.css
looks like:Issue
My problem is that if I add an image that is "too big", a code chunk with "too much" code or output, or a slide with "too much" text, the background image resizes and sometimes becomes so big I cannot see the whole background image in the slide.
The issue seems to be that there is "too much" content and so the whole slide resizes, and appears "zoomed in".
Of course one solution is just to remove some content and make the images smaller, but with a reasonable amount of text (see slide 4/5 in repro example), that option seems too cumbersome and inefficient.
Is there a CSS solution here? It is a remark-js issue? It seems like the
background-size: cover;
argument should do the trick, but it's failing here.Thanks, Sam
Reproducible Example
Here's the background image.
defaultv2.css:
test.Rmd
(Note escaped ticks for code chunks)
System Info
RStudio version 1.2.637