xaringan 및 R 마크 다운으로 프레젠테이션을 만들 때 배경 이미지의 불투명도를 조정할 수 있습니까? 예를 들어, 다음은 배경에 Karl 슬라이드 만있는 Ninja 템플릿입니다. 이 배경의 불투명도를 변경하려면 어떻게해야합니까?
편집 : 명확히하기 위해 슬라이드 쇼의 모든 배경 이미지가 아닌 경우에 따라 배경 불투명도를 조정할 수 있기를 원합니다.
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
institute: "RStudio, PBC"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
background-image: url(`r xaringan:::karl`)
background-position: 50% 50%
class: right, top
# You only live once!
<div>
CSS를 사용하여 이미지를 포함하는 상위 요소 (a ) 의 불투명도를 조정해야합니다 . 불투명도를 조정하는 CSS 클래스를 정의하는 코드 청크를 포함하는 것이 편리합니다.
```{css, echo = F}
.reduced_opacity {
opacity: 0.5;
}
```
그런 다음이 클래스를 슬라이드에 적용합니다.
---
background-image: url(`r xaringan:::karl`)
background-position: 50% 50%
class: right, top, reduced_opacity
# You only live once!
그러나 이렇게하면 슬라이드의 모든 항목이이 .NET에 '살아'있기 때문에 전체 슬라이드의 불투명도가 감소합니다 <div>
. 이를 방지하려면 ::before
슬라이드에 의사 요소 (사용 )를 추가하는 클래스에 이미지를 포함하고 다음 과 같이 불투명도를 조정할 수 있습니다.
```{css, echo = F}
.bg_karl {
position: relative;
z-index: 1;
}
.bg_karl::before {
content: "";
background-image: url('https://github.com/yihui/xaringan/releases/download/v0.0.2/karl-moustache.jpg');
background-size: cover;
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
opacity: 0.5;
z-index: -1;
}
```
그런 다음 .bg_karl
슬라이드에 추가 합니다.
---
class: right, top, bg_karl
# You only live once!
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다