Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

CSS Fluid Width Video

By nuwantha , 24 July, 2017
Question

How to set width of a youtube video automaticly ?

Example :

<div class="video-content">
    <!-- YouTube video code-->
    <iframe width="560" height="349" src="http://www.youtube.com/embed/THEVIDEOID" frameborder="0" allowfullscreen></iframe>
</div>

.video-content {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  padding-top: 25px;
  height: 0;
  iframe {
    position: absolute;
    height: 100%;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
  }
}

Tags

  • CSS
  • Theming
  • Add new comment
Add CSS stylesheets to a module (CKEditor)
Basic CSS Styling tips
SASS SCSS LESS compile

Comments1

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

good (not verified)

9 years 4 months ago

good

hello

  • Reply

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer