nayen — 2012-08-23T08:10:13-04:00 — #1
I am trying to embed a YouTube video on my responsive layout and I found the following tutorial:
http://webdesignerwall.com/tutorials/css-elastic-videos/ - http://webdesignerwall.com/demo/elastic-videos/ (demo)
It seems to be working fine except one small issue. When you narrow down the browser window and start the video, black bars will appear above and below the video as you can see in the following image:
I use the same code given in the tutorial. Is it possible to get rid of the black bars?
snickn — 2012-08-23T08:13:23-04:00 — #2
I'm by no means a CSS expert - but..
You should be able to change the
padding-bottom: 56.25%; /* 16/9 ratio */
part to fit your aspect ratio. There is nothing here that detects the aspect ratio of the video though so you need to know it up front.
Someone else can likely expand on this.
snickn — 2012-08-23T08:15:47-04:00 — #3
Also check out this post
ralphm — 2012-08-23T09:01:34-04:00 — #4
@Nail Yener — which browser are you viewing this in? Does the problem happen for you on the webdesignerwall, or just on your site? If just on your site, can you post a link?
nayen — 2012-08-23T09:20:57-04:00 — #5
The black bars are displayed on the demo link and on my page as well. I have the same code. I am viewing on Chrome and Firefox.
ralphm — 2012-08-23T09:26:35-04:00 — #6
That's odd—I don't get the black bars in either of those browsers.
snickn — 2012-08-23T09:27:49-04:00 — #7
Depends on resolution I believe. (I don't get the black bars either)
nayen — 2012-08-23T10:07:44-04:00 — #8
Really? Interesting. Just to make sure we are doing the same thing, here is the steps that I follow:
- Open the demo link.
- Narrow down the browser window to about 20% width of the screen.
- Click play on the video.