Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
321 views
in Technique[技术] by (71.8m points)

How to embed in a CSS modal iframe or pdf to full dynamic (responsive) height?

I'm using Tailwind CSS for a modal (similar to Bootstrap's one).

What I do not understand is how to embed objects (iframe, pdf) to modal body's full height (which is dynamic based on screen height).

Example: https://play.tailwindcss.com/dxKwbYilfD

I think this is not only a problem with Tailwind, is between CSS and myself! :)

As you can see I'm using height="100%" here but I need something like min-height: 100% which obviously is not working here.

What is working is height:-webkit-fill-available but is unusable on each browser because of -webkit part.

How to do here? I searched a lot without results.

<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet"/>
<div class="fixed inset-0 flex flex-col items-center justify-start p-3 md:p-16 z-20">
  <div class="absolute inset-0 bg-black opacity-50"></div>

  <div class="flex flex-col bg-white rounded-lg overflow-hidden shadow-xl md:max-w-4xl md:w-full max-h-screen z-40">
    <div class="flex justify-between border-b">
      <div class="px-3 py-2 md:px-4 md:py-3 text-lg font-semibold">Header</div>
    </div>

    <div class="p-3 md:p-4 overflow-y-auto">
      <!-- <embed width="100%" height="100%" src="https://pdfobject.com/pdf/sample-3pp.pdf"></embed> -->
      <iframe class="w-full min-h-full" width="100%" height="100%" src="https://www.youtube.com/embed/cvFt2Xcuois" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
    </div>

    <div class="bg-gray-100 border-t p-3 md:p-4">Footer</div>
  </div>
</div>
question from:https://stackoverflow.com/questions/65648354/how-to-embed-in-a-css-modal-iframe-or-pdf-to-full-dynamic-responsive-height

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...