Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(styles): provide .youtube-responsive for 16:9 rendering #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,17 @@ block-style automatic rendering is also supported, if enabled in the config:
katex_enable = true
katex_auto_render = true
```

### Special stylesheet classes

#### Rendering YouTube videos in 16:9

If you want to display an embedded YouTube video in 16:9, add class
`.youtube-responsive` when using the appropriate shortcode, e.g.:

```
{{ youtube(id="aqz-KE-bpKQ", class="youtube-responsive") }}
```

The height of the video will be scaled on different devices
responsively.
16 changes: 16 additions & 0 deletions sass/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,22 @@ main {
}
}

.post-content {
.youtube-responsive {
height: 0;
padding-bottom: 56.25%; // 16:9
position: relative;

iframe {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
}
}

.post-footer {
margin-top: 20px;
border-top: 1px solid #e6e6e6;
Expand Down