I am facing an issue with embedding a Youtube video inside a td
HTML element. I want the video to maintain its aspect ratio while expanding to fit the width of its parent td
.
My desired look for the video is like this:
However, my current video appears like this:
Is there a way to use CSS to scale up the video to utilize the full available width of the td
element while still preserving its aspect ratio?
Below is my code snippet and a link to the associated JSFiddle example:
<table width="100%">
<tr valign="top">
<td>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
</td>
<td style="width: 450px;">
<!-- Note the YouTube video is loaded using the YouTube JavaScript API-->
<iframe src="https://www.youtube.com/embed/zrWkRHSK6A8?enablejsapi=1" style="width: auto; height: auto;"></iframe>
</td>
<td>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
</td>
</tr>
</table>