JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css"
/>
<style>
/* For compact mode */
.fancybox__container.is-compact .fancybox__slide.my-iframe .fancybox__content {
width: 100%;
height: 100%;
}
/* For all other cases */
.fancybox__slide.my-iframe .fancybox__content {
width: 400px;
height: 400px;
}
</style>
</head>
<body>
<div>
<p>
<a
href="https://fancyapps.com/iframe.html"
data-fancybox
data-type="iframe"
data-custom-class="my-iframe"
>
Custom width and height using CSS
</a>
</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script>
<script>
Fancybox.bind("[data-fancybox]", {
Html: {
autoSize: false,
},
});
</script>
</body>
</html>