Tim Wilcox
Tim Wilcox

Reputation: 1331

Decreasing margin between header and text in Ioslides

For the reproducible example, I am using the default Ioslides presentation that comes with R studio. File>New File>R markdown>ioslides presentation. The data is the mtcars data set that comes with installing R Studio. Looking at slide 2 (R Markdown), I want the margin to be about half of what it is. However, not finding success. Any thoughts on how this can be done?

My YAML is as such

 title: "margin example"
 author: "Tim"
 date: "2/2/2021"
 output: 
     ioslides_presentation:
          css: styles.css

Next is the CSS that I am using

h2{
font-family:'Arial';
font-size:22px !important;
padding-bottom:1px;
margin:1px;
margin-bottom:1px;
}

p {
font-size: 18px;
margin:1px;
margin-bottom:0px;
margin-top:0px;
}

Upvotes: 3

Views: 494

Answers (1)

Bernhard Piskernik
Bernhard Piskernik

Reputation: 145

Add a new class to your CSS

.reduceTopMarginText p:first-of-type {
  margin-top: -25px
}

and assign it to your slide

## Titel {.reduceTopMarginText}

Text closer to your title.

If the first element on your slide is not text but code, then replace p with pre in the CSS.

Upvotes: 1

Related Questions