Bootstrap Ratio Shortcode

The ratio shortcode is perfect for responsively handling video or slideshow embeds based on the width of the parent.

Donate

Become a backer or sponsor to support our work.

On this page

Sponsors

Syntax

1{{< bs/ratio [size] >}}
2CONTENT HERE
3{{< /bs/ratio >}}

Parameters

ratio

PositionNameTypeRequiredDefaultSinceExample
#0ratiostring-16x9--

The aspect ratio, 1x1, 4x3, 16x9 and 21x9.

Examples

Aspect Ratio 1x1

Source
1{{< bs/ratio 1x1 >}}
2  {{< bilibili BV1iT411B7yH >}}
3{{< /bs/ratio >}}
Result

Aspect Ratio 4x3

Source
1{{< bs/ratio 4x3 >}}
2  {{< bilibili BV1iT411B7yH >}}
3{{< /bs/ratio >}}
Result

Aspect Ratio 16x9

Source
1{{< bs/ratio 16x9 >}}
2  {{< bilibili BV1iT411B7yH >}}
3{{< /bs/ratio >}}
Result

Aspect Ratio 21x9

Source
1{{< bs/ratio 21x9 >}}
2  {{< bilibili BV1iT411B7yH >}}
3{{< /bs/ratio >}}
Result