I am facing a challenge where I need to utilize some Vimeo iFrames as a video background with a widescreen aspect ratio. The problem lies in getting the iframe to expand to the full width of its parent container, disregarding its own dimensions. My current setup involves working with Tailwind in a Next.js application.
Here is the parent element, stretching across the entire width of the page...
https://i.sstatic.net/pVVz3.jpg
Meanwhile, this is how the embedded video appears at the moment:
https://i.sstatic.net/zXv5F.jpg
Any advice on how I can extend the video to occupy the full width of its parent container? Below are snippets of the JSX code for my components:
ProjectCard.tsx
<div className="group relative flex aspect-widescreen items-center justify-center overflow-hidden">
<h3 className="absolute z-10 mx-auto text-center font-serif text-sm uppercase tracking-[15px] text-white opacity-0 transition-opacity duration-700 group-hover:opacity-100 md:text-3xl md:tracking-[1.5625rem]">
{asText(project.title)}
</h3>
<Image
src={getImageUrl(project.cover.widescreen.url)}
width={project.cover.widescreen.dimensions?.width}
height={project.cover.widescreen.dimensions?.height}
alt={asText(project.title)}
className="w-full"
placeholder="blur"
blurDataURL={getBlurUrl(project.cover.widescreen.url)}
quality={100}
/>
{preview ? <ProjectPreview preview={project.preview} /> : null}
</div>
ProjectPreview.tsx
<iframe
src="iframeSrc"
className="absolute inset-0 aspect-widescreen h-full w-full overflow-hidden object-fill"
allowFullScreen
/>