2

When using Tailwind UI modal with long text content, modal heading and close button go off screen. is there a solution to display long content in a modal? for example is a scrollable modal possible in tailwind ui?

Code used is from https://tailwindui.com/components/application-ui/overlays/modals

tailwind modal with long content

Modal code:

<div id="modal-terms2" tabindex="-1" class="hidden  overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 w-full md:inset-0 h-modal md:h-full justify-center items-center flex" aria-modal="true" role="dialog">
<div class="relative p-4 w-full max-w-2xl h-full md:h-auto">
    <!-- Modal content -->
    <div class="relative bg-white rounded-lg max-w-4xl shadow dark:bg-gray-700">
        <button type="button" id="close-terms2" class="absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white" data-modal-toggle="authentication-modal">
            <svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
            <span class="sr-only">Close modal</span>
        </button>
        <div class=" overscroll-auto py-6 px-6 lg:px-8">
            <h3 class="mb-4 text-xl font-medium text-gray-900 dark:text-white">Headline</h3>

          <p>
            1<br />
            2<br />
            3<br />
            4<br />
            5<br />
            6<br />
            7<br />
            8<br />
            9<br />
            10<br />
            11<br />
            12<br />
            13<br />
            14<br />
            15<br />
            16<br />
            17<br />
            18<br />
            19<br />
            20<br />
            1<br />
            1<br />
            1<br />
            1<br />
            1<br />
            1<br />
            1<br />
            1<br />
            1<br />
            1<br />
            1<br />
          </p>
            
        </div>
    </div>
</div>
tonsaa
  • 41
  • 3

0 Answers0