This is a chat app I am building. What is SUPPOSED to happen with the CSS is the div should always show the latest message at the bottom. When someone types a new message, it should scroll down to the bottom to show the newest message. Right now all it does is post the new message but doesnt scroll and on page reload the oldest message is shown at the top not the newest at the bottom (you gotta scroll to see it.
<div class="h-full pb-2 mb-2 pt-0 mt-0 shadow-md overflow-y-auto">
<div class="flex flex-col-reverse justify-end">
<div class="bg-white">
<div>
<div class="flex space-x-3 px-3">
<img class="mt-4 h-8 w-8 rounded-full" src="http://localhost:8000/storage/profile-photos/GGsymBqzbfC6nOWHyFsBEwAdqJtICgo0DcypPlMR.jpg" alt="Ryan Olson">
<div class="flex-1 space-y-1">
<div class="flex items-center justify-between">
<h3 class="pt-2 text-sm font-medium">Ryan Olson</h3>
<p class="text-sm text-gray-500">9/2/2021, 12:12:49 PM</p>
</div>
<p class="text-md text-gray-500">this is a test</p>
</div>
</div>
</div>
</div>
<div class="bg-gray-100">
<div>
<div class="flex space-x-3 px-3">
<img class="mt-4 h-8 w-8 rounded-full" src="http://localhost:8000/storage/profile-photos/GGsymBqzbfC6nOWHyFsBEwAdqJtICgo0DcypPlMR.jpg" alt="Ryan Olson">
<div class="flex-1 space-y-1">
<div class="flex items-center justify-between">
<h3 class="pt-2 text-sm font-medium">Ryan Olson</h3>
<p class="text-sm text-gray-500">9/2/2021, 12:09:34 PM</p>
</div>
<p class="text-md text-gray-500">testing</p>
</div>
</div>
</div>
</div>
<div class="bg-white">
<div>
<div class="flex space-x-3 px-3">
<img class="mt-4 h-8 w-8 rounded-full" src="http://localhost:8000/storage/profile-photos/GGsymBqzbfC6nOWHyFsBEwAdqJtICgo0DcypPlMR.jpg" alt="Ryan Olson">
<div class="flex-1 space-y-1">
<div class="flex items-center justify-between">
<h3 class="pt-2 text-sm font-medium">Ryan Olson</h3>
<p class="text-sm text-gray-500">9/1/2021, 12:46:38 AM</p>
</div>
<p class="text-md text-gray-500">fhfdgh</p>
</div>
</div>
</div>
</div>
<div class="bg-gray-100">
<div>
<div class="flex space-x-3 px-3">
<img class="mt-4 h-8 w-8 rounded-full" src="http://localhost:8000/storage/profile-photos/GGsymBqzbfC6nOWHyFsBEwAdqJtICgo0DcypPlMR.jpg" alt="Ryan Olson">
<div class="flex-1 space-y-1">
<div class="flex items-center justify-between">
<h3 class="pt-2 text-sm font-medium">Ryan Olson</h3>
<p class="text-sm text-gray-500">9/1/2021, 12:45:38 AM</p>
</div>
<p class="text-md text-gray-500">https://localhost:8000</p>
</div>
</div>
</div>
</div>
<div class="bg-white">
<div>
<div class="flex space-x-3 px-3">
<img class="mt-4 h-8 w-8 rounded-full" src="http://localhost:8000/storage/profile-photos/GGsymBqzbfC6nOWHyFsBEwAdqJtICgo0DcypPlMR.jpg" alt="Ryan Olson">
<div class="flex-1 space-y-1">
<div class="flex items-center justify-between">
<h3 class="pt-2 text-sm font-medium">Ryan Olson</h3>
<p class="text-sm text-gray-500">9/1/2021, 12:39:47 AM</p>
</div>
<p class="text-md text-gray-500">How much does it tap into the web server</p>
</div>
</div>
</div>
</div>
<div class="bg-gray-100">
<div>
<div class="flex space-x-3 px-3">
<img class="mt-4 h-8 w-8 rounded-full" src="http://localhost:8000/storage/profile-photos/GGsymBqzbfC6nOWHyFsBEwAdqJtICgo0DcypPlMR.jpg" alt="Ryan Olson">
<div class="flex-1 space-y-1">
<div class="flex items-center justify-between">
<h3 class="pt-2 text-sm font-medium">Ryan Olson</h3>
<p class="text-sm text-gray-500">9/1/2021, 12:39:34 AM</p>
</div>
<p class="text-md text-gray-500">I wonder how this works</p>
</div>
</div>
</div>
</div>
</div>
</div>
I am just not sure what I am missing.
inside <div class="flex flex-col-reverse justify-end"> I had to also put h-full
Related
I have three divs in a grid. the height automatically adjusts to the written content. however, if one div contains too much text, the other two are enlarged incorrectly. I have already tried h-max, h-full and everything else.
Actually, the div in the middle of one of these blocks should be enlarged so that it is always flush at the bottom.
for further information please refer to the picture
<div class="grid grid-cols-6 gap-4">
<div class="bg-green shadow overflow-hidden sm:rounded-lg col-span-2">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-lg leading-3 font-medium text-gray-100">24 Hours challenge</h3>
</div>
<div class="bg-gray-50 px-4 py-5 text-center">
<a class="text-md font-bold text-gray-500">Ask a stranger if they would like to hear a poem you made. Then improvise a poem if they say yes</a>
</div>
<div class="bg-gray-100 px-4 py-1 text-center">
<a class="text-sm font-medium text-gray-500">06:12:53 left</a>
</div>
</div>
<div class="bg-green shadow overflow-hidden sm:rounded-lg col-span-2">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-lg leading-3 font-medium text-gray-100">3 Days challenge</h3>
</div>
<div class="bg-gray-50 px-4 py-5 text-center">
<a class="text-md font-bold text-gray-500">Act as if you know a stranger</a>
</div>
<div class="bg-gray-100 px-4 py-1 text-center">
<a class="text-sm font-medium text-gray-500">30:07:00 left</a>
</div>
</div>
<div class="bg-green shadow overflow-hidden sm:rounded-lg col-span-2">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-lg leading-3 font-medium text-gray-100">Weekly challenge</h3>
</div>
<div class="bg-gray-50 px-4 py-5 text-center">
<a class="text-md font-bold text-gray-500">Sing a song in public</a>
</div>
<div class="bg-gray-100 px-4 py-1 text-center">
<a class="text-sm font-medium text-gray-500">54:06:43 left</a>
</div>
</div>
</div>
flex-grow is the answer thx to Ihar
<div class="bg-gray-50 px-4 py-5 text-center flex-grow">
I am trying to center the rounded full image between the main cover photo and the left column. For some reason I cannot get it to move from the top left corner and I cannot see what I am doing wrong. I am using Tailwind CSS.
<Head :title="profile.name" />
<div class="relative w-full max-h-screen bg-gray-900 flex justify-start items-center rounded-lg">
<div class="relative flex w-full h-48 bg-gray-700">
<img :src="profile.cover_photo_path" class="cover-bg w-full "/>
<div class="absolute inset-0 bottom-0 left-0">
<img :src="profile.profile_photo_path" class="w-48 h-48 rounded-full border-2 border-red-600"/>
</div>
</div>
</div>
<div class="flex flex-row">
<!-- Left Column -->
<div class="bg-gray-900 w-1/3 h-96 z-0">
</div>
<!-- Right Column -->
<div class="bg-gray-900 w-2/3 h-48 z-0">
<div class="flex flex-row justify-between px-2 items-center h-12 border-b border-red-700">
<div class="text-white text-center font-normal"> Feed </div>
<div class="text-white text-center font-normal"> About </div>
<div class="text-white text-center font-normal"> Photos </div>
<div class="text-white text-center font-normal"> Videos </div>
<div class="text-white text-center font-normal"> Events </div>
<div class="text-white text-center font-normal"> Groups </div>
<div class="text-white text-center font-normal"> Pages </div>
<div class="text-white text-center font-normal"> Followers </div>
<div class="text-white text-center font-normal"> Following </div>
</div>
</div>
</div>
</template>
As far as I understood , you want the circle rounded image in the middle of cover and left sidebar vertically and over them.
So I had created this ,please verify if you want. Else I would rather suggest you to attach a screenshot of what you want .
<script src="https://cdn.tailwindcss.com"></script>
<div class="relative flex max-h-screen w-full items-center justify-start rounded-lg bg-gray-900">
<div class="relative flex h-48 w-full bg-gray-700">
<img src="http://codeskulptor-demos.commondatastorage.googleapis.com/GalaxyInvaders/back05.jpg" class="cover-bg w-full" />
<div class="absolute inset-0 top-1/2 left-10 z-10">
<img src="http://codeskulptor-demos.commondatastorage.googleapis.com/pang/IHXoEES.png" class="h-48 w-48 rounded-full border-2 border-red-600" />
</div>
</div>
</div>
<div class="flex flex-row">
<!-- Left Column -->
<div class="z-0 h-96 w-1/3 bg-gray-900"></div>
<!-- Right Column -->
<div class="z-0 h-48 w-2/3 bg-gray-800">
<div class="flex h-12 flex-row items-center justify-between border-b border-red-700 px-2">
<div class="text-center font-normal text-white">Feed</div>
<div class="text-center font-normal text-white">About</div>
<div class="text-center font-normal text-white">Photos</div>
<div class="text-center font-normal text-white">Videos</div>
<div class="text-center font-normal text-white">Events</div>
<div class="text-center font-normal text-white">Groups</div>
<div class="text-center font-normal text-white">Pages</div>
<div class="text-center font-normal text-white">Followers</div>
<div class="text-center font-normal text-white">Following</div>
</div>
</div>
</div>
Hello I'm trying to make responsive websites through tailwind CSS but when I'm dragging the page to small devices the contents are not aligning with the main walls. This is my code-
<div class="navbar flex justify-between items-center p-4">
<div class="hamburger inline-block cursor-pointer md:hidden">
<div class="line h-0.5 w-6 my-1 bg-black"></div>
<div class="line h-0.5 w-6 my-1 bg-black"></div>
<div class="line h-0.5 w-6 my-1 bg-black"></div>
</div>
<div class="logo text-center flex ">
<div>Restaurant</div>
<div
class="nav-links absolute w-fit md:static md:w-auto inset-0 md:flex md:mx-6 md:space-x-6 -translate-x-96 md:translate-x-0">
<div class="links"><a class="link" href="">Services</a></div>
<div class="links"><a class="link" href="">Support</a></div>
<div class="links"><a class="link" href="">Premium</a></div>
</div>
</div>
<div class="link cart text-center md:order-1">Cart</div>
</div>
<div class="slider flex flex-col-reverse justify-around md:flex-row bg-[#ecf0f1]">
<div class="left flex flex-col justify-center items-center md:items-baseline py-12">
<h1 class="text-2xl font-medium md:text-4xl mx-5 text-center">Food on the go</h1>
<p class="text-center md:text-left md:w-3/4 mx-5 my-2">Explore your favourite food and restaurants and
get them delivered at your doorstep.</p>
<button class="bg-black text-white px-5 py-2 my-2 font-bold mx-5 ">Browse</button>
</div>
<div class="right">
<img class="md:w-[50rem]"
src="https://images.pexels.com/photos/1410236/pexels-photo-1410236.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1"
alt="">
</div>
</div>
I want to align the text under the image here is the screenshot of what I am doing.
Help me out here I want the code to be in tailwind css.
Do you mean like this?
<script src="https://cdn.tailwindcss.com"></script>
<div class=" p-8 bg-gray-100">
<div class="w-96 flex justify-start space-x-3 bg-gray-200 h-48 rounded-md p-8">
<div class="space-y-4 text-center">
<div class="w-16 h-16 bg-teal-700 rounded-full"></div>
<h1 class=" px-2 py-0.5 bg-gray-50 border-2 border-gray-300 ">First Name</h1>
</div>
<div class="space-y-4 text-center">
<div class="w-16 h-16 bg-teal-700 rounded-full"></div>
<h1 class=" px-2 py-0.5 bg-gray-50 border-2 border-gray-300 ">SecondName</h1>
</div>
</div>
</div>
You just need to do this. It works for me.
<div class="flex p-10 ">
<div class="mx-5">
<div class="w-20 h-20 ">
<img src="https://comps.gograph.com/penguin-emotional-head-vector-illustration-of-cute-arctic-bird-in-sunglasses-shows-emotion-cool-emoji-smiley-icon-print-chat-communication-penguin-in-flat-cartoon-style-on-blue-background_gg103004116.jpg" className="rounded-full"/>
</div>
<p class="mt-3 p-1 border-2 border-teal-200 ">Zain UI Adideen</p>
</div>
<div class="mx-5">
<div class="w-20 h-20">
<img src="https://comps.gograph.com/penguin-emotional-head-vector-illustration-of-cute-arctic-bird-in-sunglasses-shows-emotion-cool-emoji-smiley-icon-print-chat-communication-penguin-in-flat-cartoon-style-on-blue-background_gg103004116.jpg" className="rounded-full"/>
</div>
<p class="mt-3 p-1 border-2 border-teal-200 ">Akira Ito</p>
</div>
</div>
How can I make these two boxes (I'll have them more) to have same width as the widest one using tailwindcss only classes?
<head>
<link href="https://unpkg.com/tailwindcss#^1.0/dist/tailwind.min.css" rel="stylesheet"/>
</head>
<body>
<div class="flex flex-wrap">
<div class="max-w-xs border">
<div class="flex flex-col items-center pt-6 pb-6 px-10">
<p class="font-bold text-xl mb-5">Company1</p>
<img class="h-16 mb-5" src="https://via.placeholder.com/150" />
<p class="mb-2 text-center font-bold">Junior Ruby on Rails Developer</p>
<p class="text-sm">11500 - 17750 (B2B)</p>
</div>
</div>
<div class="max-w-xs border">
<div class="flex flex-col items-center pt-6 pb-6 px-10">
<p class="font-bold text-xl mb-5">Company2</p>
<img class="h-16 mb-5" src="https://via.placeholder.com/150" />
<p class="mb-2 text-center font-bold">Ruby on Rails Developer</p>
<p class="text-sm">11500 - 17750 (B2B)</p>
</div>
</div>
</div>
</body>
<div class="flex flex-wrap">
<div class="max-w-xs border">
<div class="flex flex-col items-center pt-6 pb-6 px-10">
<p class="font-bold text-xl mb-5">Company1</p>
<img class="h-16 mb-5" src="https://via.placeholder.com/150" />
<p class="mb-2 text-center font-bold">Junior Ruby on Rails Developer</p>
<p class="text-sm">11500 - 17750 (B2B)</p>
</div>
</div>
<div class="max-w-xs border">
<div class="flex flex-col items-center pt-6 pb-6 px-10">
<p class="font-bold text-xl mb-5">Company2</p>
<img class="h-16 mb-5" src="https://via.placeholder.com/150" />
<p class="mb-2 text-center font-bold">Ruby on Rails Developer</p>
<p class="text-sm">11500 - 17750 (B2B)</p>
</div>
</div>
</div>
Add class flex-1 to your divs <div class="max-w-xs border">.
// git diff
- <div class="max-w-xs border">
+ <div class="max-w-xs border flex-1">