Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #31531
Closed
Open
Issue created Aug 24, 2020 by Administrator@rootContributor

Add responsive embed class with ratio by variable

Created by: thenewguy

It would be handy if there was support for a variable ratio.

For example,

<style>
    .embed-responsive-by-ratio::before {
        padding-top: 56.25%; /* 16:9 fallback when var() not supported */
        padding-top: var(--embed-responsive-by-ratio);
    }
</style>

<div class="embed-responsive embed-responsive-by-ratio" style="--embed-responsive-by-ratio: 17.8%;"></div>

When templating a known width and height it is simpler to calculate the padding than determine which of your classes is a closer fit.

Didn't see this in the documentation but it is pretty simple and working for me - would probably be generally useful

Assignee
Assign to
Time tracking