Skip to content

Aspect ratio padding for iframe videos #60

@mdt2

Description

@mdt2

We copy/paste this code from project to project, it would be nice to have here! The 56.25% creates the 16:9 aspect ratio.

.video {
  // Creates a container with at 16:9 aspect ratio
  height: 0 !important;
  padding-bottom: 56.25% !important;
  position: relative;
  iframe {
    position: absolute;
    width: 100%;
    height: 100%;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions