Home > Mobile >  Text escaping div on mobile screen size
Text escaping div on mobile screen size

Time:11-27

I got a site where a lot of text will be displayed, when it is in normal screen size it works fine, but when I shrink the browser to mobile size the text escapes the div, as seen here:

https://i.stack.imgur.com/LMPH7.png

Here is the blade file:

<div class="flex justify-center ">
    <div class="w-11/12 bg-gray-400 p-6 rounded-lg font-serif text-4xl font-bold bg-opacity-70 subpixel-antialiased tracking-wide not-italic">
        <div class="p-10 shadow-2xl mb-10 bg-gradient-to-r from-green-400 to-blue-500 border-solid border-2 border-black rounded-lg">
            <div class="bg-gray-100 shadow-2xl border-solid border-2 border-gray-500 rounded-lg">

                <h1 class="pt-2 pl-4 text-4xl font-bold text-gray-900 title-font mb-8 underline">
                    {{ $post->Titel }}
                </h1>

                <div class="flex-grow">
                    <div>
                        <div class="pt-2 pl-4 pb-3 ml-8 font-medium text-base font-bold font-serif"> Standort: {{ $post->Standort }}</div>
                        <div class="pt-2 pl-4 pb-3 ml-8 font-medium text-base font-bold font-serif"> Kontakt: {{ $post->Kontakt }}</div>
                        <div class="pt-2 pl-4 pb-3 ml-8 font-medium text-base font-bold font-serif"> Startdatum: {{ $post->startdate }}</div>
                        <div class="pt-2 pl-4 pb-3 ml-8 font-medium text-base font-bold font-serif mb-8"> Enddatum: {{ $post->enddate }}</div>
                        <div class="flex-grow ml-5 ml-8 break-words mb-5 content w-full md:w-3/4 pr-4 text-lg text-justify tracking-widest leading-loose mr-7 subpixel-antialiased">
                            {!! $post->Beschreibung !!}
                        </div>
                    </div>
                </div>
                <div class="flex justify-start font-medium text-base font-bold font-serif mb-5 ml-8">
                    <button type="submit" class="text-white px-4 py-3 rounded text-base font-medium
                                bg-gradient-to-r from-green-400 to-blue-500 float-right shadow transition
                                duration-500 ease-in-out transform hover:-translate-y-1 hover:scale-100">Direkt bewerben!</button>
                </div>
            </div>
        </div>
    </div>
</div>

I tried it with break-words and break-all. Aswell trying to add a padding or margin.. but I am fairly new to css and I think it isn't the correct approach.

The div with the text in it is the one with {!! $post->beschreibung !!}

CodePudding user response:

Try removing the w-full css class. w-full will set the width to be 100% of the parent, which in combination with the ml-5 ml-8 classes, will exceed the parent's size.

Like this: https://jsfiddle.net/o93udj4v/

  • Related