Bootstrap Tutorial

BS4 HomeBS4 Container

BS4 Borders

BS4 Border AdditiveBS4 Border SubtractiveBS4 Border ColorBS4 Border Radius

BS4 Float

BS4 floatBS4 clearfix

BS4 Close icon

BS4 Close Icon

BS4 Colors

BS4 ColorBS4 Background color

BS4 Display

BS4 Display NotationBS4 Display in Print

BS4 Embed

BS4 embed

BS4 Flex

BS4 FlexBS4 Flex DirectionBS4 justify-contentBS4 align-itemsBS4 align-selfBS4 align-contentBS4 Flex GrowBS4 Flex ShrinkBS4 Flex FillBS4 Flex WrapBS4 OrderBS4 Auto Margins

BS4 Sizing

BS4 WidthBS4 Height

BS4 Spacing

BS4 MarginBS4 PaddingBS4 Horizontal centering

BS4 Text

BS4 Text alignmentBS4 Text wrappingBS4 Text transformBS4 Font weight and italicsBS4 Text decorationBS4 Text resetBS4 Text monospace

BS4 Alignment

BS4 Vertical alignment

BS4 Visibility

BS4 Visibility

BS4 Overflow

BS4 Overflow

BS4 Link

BS4 Stretched Link

BS4 Shadow

BS4 Shadow

BS4 Position

BS4 Position

BS4 Typography

BS4 Typography HeadingsBS4 Typography Custom HeadingsBS4 Typography Display HeadingsBS4 Typography LeadBS4 Typography Inline textBS4 Typography AbbreviationsBS4 Typography BlockquotesBS4 Typography List UnstyledBS4 Typography List Inline

BS4 Code

BS4 Code InlineBS4 Code BlocksBS4 Code VariablesBS4 Sample OutputBS4 User input

BS4 Image

BS4 Image ResponsiveBS4 Image Thumbnails

BS4 Figures

BS4 Figure

BS4 Grid

BS4 Grid

BS4 Media Object

BS4 Media Object

BS4 Table

BS4 TableBS4 Table HeadBS4 Table CaptionsBS4 Table Responsive

BS4 Components

BS4 AlertBS4 BadgeBS4 BreadcrumbBS4 ButtonBS4 Button GroupBS4 CardBS4 CarouselBS4 CollapseBS4 DropdownBS4 FormBS4 Input GroupBS4 JumbotronBS4 List GroupBS4 ModalBS4 NavsBS4 NavbarBS4 PaginationBS4 PopoversBS4 ProgressBS4 SpinnersBS4 TooltipsBS4 ToastsBS4 Scrollspy

Bootstrap4 Embed

Last Updated:

What is Embed?

Bootstrap4 embed utility classes will create a responsive video or slideshow based on the width of the parent by creating an intrinsic ratio that scales on any device.

Bootstrap4 embed's contextual classes are directly applied to <iframe>, <embed>, <video>, and <object> elements; optionally use an explicit descendant class .embed-responsive-item when you want to match the styling for other attributes.

The below example will demonstrate how to use Bootstrap4 embeds.


HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href=""> <script src=""></script> <script src=""></script> <script src=""></script> </head> <body> <h1>Embed</h1> <p><strong>Note</strong>: Use main vertical scroll bar to see the difference</p> <!-- 21:9 aspect ratio --> <h4>embed-responsive-21by9</h4> <div class="embed-responsive embed-responsive-21by9"> <embed class="embed-responsive-item" src="/resume.pdf" width="400" height="500"> </div> <!-- 16:9 aspect ratio --> <h4>embed-responsive-16by9</h4> <div class="embed-responsive embed-responsive-16by9"> <embed class="embed-responsive-item" src="/resume.pdf" width="400" height="500"> </div> <!-- 4:3 aspect ratio --> <h4>embed-responsive-4by3</h4> <div class="embed-responsive embed-responsive-4by3"> <embed class="embed-responsive-item" src="/resume.pdf" width="400" height="500"> </div> <!-- 1:1 aspect ratio --> <h4>embed-responsive-1by1</h4> <div class="embed-responsive embed-responsive-1by1"> <embed class="embed-responsive-item" src="/resume.pdf" width="400" height="500"> </div> </body> </html>


The following table provides a list of all classes to embed the content.

Class Explanation
.embed-responsive Container for embedded content. Makes embeded item (video, pdf, etc) scale properly on any device.
.embed-responsive-item Used inside .embed-responsive. Scales the embeded item nicely to the parent element.
.embed-responsive-21by9 Container for embedded content. Creates an 21:9 aspect ratio embedded content.
.embed-responsive-16by9 Container for embedded content. Creates an 16:9 aspect ratio embedded content.
.embed-responsive-4by3 Container for embedded content. Creates an 4:3 aspect ratio embedded content.
.embed-responsive-1by1 Container for embedded content. Creates an 1:1 aspect ratio embedded content.

Share this Page

Meet the Author