I want to place the avatar label texts to be vertically centered of the avatar image
<div class="flex flex-wrap">
<div class="flex mr-8">
<div class="rounded-full overflow-hidden w-24 h-24">
<img
src="https://via.placeholder.com/150"
alt="Avatar"
class="w-full h-full object-cover"
/>
</div>
<div class="ml-4">
<span class="text-lg font-bold block text-gold">Avatar 1</span>
<span class="text-lg text-right text-black">Additional Text 1</span>
</div>
</div>
<div class="flex">
<div class="rounded-full overflow-hidden w-24 h-24">
<img
src="https://via.placeholder.com/150"
alt="Avatar"
class="w-full h-full object-cover"
/>
</div>
<div class="ml-4">
<span class="text-lg font-bold block text-gold">Avatar 2</span>
<span class="text-lg text-right text-black">Additional Text 2</span>
</div>
</div>
</div>
it doesn’t work if I place justify center to the div
of the label text.
I’ve tried to used chatGPT
but it insists on placing items-center to the main div
.
2
Answers
Use
items-center
.https://play.tailwindcss.com/6nnQETxb7v
You can use
items-center
class where you have your flex div.https://play.tailwindcss.com/AWSjDJrZVz