How can I change the h2 header styles for specific slides only using the {} syntax?
I want to create a html presentation using rmarkdown
and ioslides
.
Some of the main slides should include images, and their titles should not overlap the image.
I am trying to influence their layout using some css ID (or class) specified in the www/cust.css
file.
markdown:
---
title: "TITLE"
subtitle: "subtitle"
output:
ioslides_presentation:
css: www/cust.css
---
# Main 0
## sub
# Main 1 {.cust-1 .rcorners}
```{r,echo=FALSE, fig.cap= "an img caption", out.width= '50%', fig.pos='top'}
knitr::include_graphics("www/SMPTE_Color_Bars.svg")
` ``
# Main 2 {.cust-2}
```{r,echo=FALSE, fig.cap= "an img caption", out.width= '50%', fig.pos='top'}
knitr::include_graphics("www/SMPTE_Color_Bars.svg")
` ``
# Main 3 {#cust-3 .rcorners}
```{r,echo=FALSE, fig.cap= "an img caption", out.width= '50%', fig.pos='top'}
knitr::include_graphics("www/SMPTE_Color_Bars.svg")
` ``
# Main 4 {#cust-4}
```{r,echo=FALSE, fig.cap= "an img caption", out.width= '50%', fig.pos='top'}
knitr::include_graphics("www/SMPTE_Color_Bars.svg")
` ``
css
slides > slide:not(.nobackground):before {
left: initial;
bottom: initial;
right: 0;
top: 0;
width: 100px;
height: 100px;
background-size: 115px 115px;
}
.cust-1 {
font-weight: 200;
font-size: 10px;
line-height: 1.1;
position: relative;
left: -6px;
bottom: 60px;
}
.rcorners img{
border-radius: 45px;
padding: 20px;
}
.cust-2 h2{
font-weight: 200;
font-size: 10px;
line-height: 1.1;
position: relative;
left: -6px;
bottom: 60px;
}
#cust-3 h2{
font-weight: 200;
font-size: 10px;
line-height: 1.1;
position: relative;
left: -10px;
bottom: 60px;
}
#cust-4 {
font-weight: 200;
font-size: 10px;
line-height: 1.1;
position: relative;
left: -10px;
bottom: 60px;
}
.auto-fadein h2{
font-weight: 200;
font-size: 100px;
line-height: 1.1;
position: relative;
left: -6px;
top: 0px;
}
.gdbar img {
width: 150px !important;
height: 150px !important;
margin: 8px 8px;
}
.gdbar {
width: 250px !important;
height: 170px !important;
}
aside.gdbar {
left: initial;
right: 0;breaker.s
border-top-left-radius: 10px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 10px;
background-position: right;
}
<style>
div.footnotes {
position: absolute;
bottom: 0;
margin-bottom: 10px;
width: 80%;
font-size: 0.6em;
However the problem i am facing is that i can't influence the h2
header class via the {.cust-x}
or {#cust-x}
syntax.
It either influences the image and subtitle:
or, if i use h2
like this:
.cust-2 h2{
font-weight: 200;
font-size: 10px;
line-height: 1.1;
position: relative;
left: -6px;
bottom: 60px;
}
it has no influence whatsoever.
Usually these markdown first level header slides are using this css:
.auto-fadein h2{
font-weight: 200;
font-size: 100px;
line-height: 1.1;
position: relative;
left: -6px;
top: 0px;
}
But i cant change this class because it will interfere with the title page, etc.
EDIT
The syntax: {} works fine if i try to target other html objects for examle using this css style:
.rcorners img{
border-radius: 45px;
padding: 20px;
}
gives me rounded image corners in example 1 and three where it is applied.
` has a different color, so I was able to target a certain `
– Rok Benko May 30 '23 at 16:42`. What's your goal?
` because it's not a child or descendant of the `` with the `class="cust-1"` if you write `# Main 1 {.cust-1}` in the markdown file.
– Rok Benko Jun 04 '23 at 17:45