Im trying to create a filter to filter different products but so far no success
ive tried different ways like using a long way by using IF for every filter didnt get it to work and code was way to big, tried for loop also wasnt able to do it
im trying to use "data" attribute in HTML to mark items seems to be a best way to do it?
any help is more then welcome
heres a code bellow
const buttons = document.querySelectorAll('.btn')
const products = document.querySelectorAll('.products')
buttons.forEach(function (button) {
button.addEventListener('click', (event) => {
event.preventDefault()
/* active button */
buttons.forEach((button) => {
button.classList.remove('active')
})
button.className = 'active'
products.forEach(product => {
showProduct = button.textContent
if (product.getAttribute('data-filter') == showProduct.toLowerCase()){
product.style.display = 'block'
} else {
product.style.display = 'none'
}
})
})
})
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://unpkg.com/tailwindcss#^2/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body class="bg-indigo-900 font-mono">
<nav class="mt-4 mb-10 text-white">
<div class="nav-bar">
<ul class="flex flex-row justify-center items-center space-x-8">
<li class=" transition transform duaration-100 hover:scale-110">
<a class="active btn filter-btn" href="#">All</a>
</li>
<li class="transition transform duaration-100 hover:scale-110">
<a class="btn filter-btn" href="#">Cake</a>
</li>
<li class="transition transform duaration-100 hover:scale-110">
<a class="btn filter-btn" href="#">Cookies</a>
</li>
<li class="transition transform duaration-100 hover:scale-110">
<a class="btn filter-btn" href="#">Donuts</a>
</li>
<li class="transition transform duaration-100 hover:scale-110">
<a class="btn filter-btn" href="#">Pudding</a>
</li>
</ul>
</div>
</nav>
<main>
<section class="container mx-auto flex flex-row justify-center items-center ">
<div class="grid grid-flow-row grid-cols-4 grid-rows-4 gap-10 ">
<!-- cakes -->
<div class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img data-filter='cake' src="https://images.pexels.com/photos/291528/pexels-photo-291528.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products w-full h-full object-cover"/>
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
<a href="https://www.google.com" class="inline-block rounded-sm font-medium border border-solid cursor-pointer text-center transition-colors duration-200 text-base py-3 px-6 text-white bg-green-400 border-green-400 hover:bg-green-600 hover:border-green-600" >View Source</a>
</div>
</div>
</div>
<div class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img data-filter='cake' src="https://images.pexels.com/photos/1070850/pexels-photo-1070850.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products w-full h-full object-cover"/>
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
<a href="https://www.google.com" class="inline-block rounded-sm font-medium border border-solid cursor-pointer text-center transition-colors duration-200 text-base py-3 px-6 text-white bg-green-400 border-green-400 hover:bg-green-600 hover:border-green-600" >View Source</a>
</div>
</div>
</div>
<!-- cookies -->
<div class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img data-filter='cookies' src="https://images.pexels.com/photos/890577/pexels-photo-890577.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products w-full h-full object-cover"/>
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
<a href="https://www.google.com" class="inline-block rounded-sm font-medium border border-solid cursor-pointer text-center transition-colors duration-200 text-base py-3 px-6 text-white bg-green-400 border-green-400 hover:bg-green-600 hover:border-green-600" >View Source</a>
</div>
</div>
</div>
<div class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img data-filter='cookies' src="https://images.pexels.com/photos/1020585/pexels-photo-1020585.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products w-full h-full object-cover"/>
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
<a href="https://www.google.com" class="inline-block rounded-sm font-medium border border-solid cursor-pointer text-center transition-colors duration-200 text-base py-3 px-6 text-white bg-green-400 border-green-400 hover:bg-green-600 hover:border-green-600" >View Source</a>
</div>
</div>
</div>
<!-- donuts -->
<div class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img data-filter='donuts' src="https://images.pexels.com/photos/2955820/pexels-photo-2955820.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products w-full h-full object-cover"/>
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
<a href="https://www.google.com" class="inline-block rounded-sm font-medium border border-solid cursor-pointer text-center transition-colors duration-200 text-base py-3 px-6 text-white bg-green-400 border-green-400 hover:bg-green-600 hover:border-green-600" >View Source</a>
</div>
</div>
</div>
<div class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img data-filter='donuts' src="https://images.pexels.com/photos/3656118/pexels-photo-3656118.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products w-full h-full object-cover"/>
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
<a href="https://www.google.com" class="inline-block rounded-sm font-medium border border-solid cursor-pointer text-center transition-colors duration-200 text-base py-3 px-6 text-white bg-green-400 border-green-400 hover:bg-green-600 hover:border-green-600" >View Source</a>
</div>
</div>
</div>
<!-- pudding -->
<div class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img data-filter='pudding' src="https://images.pexels.com/photos/302468/pexels-photo-302468.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500" class="products w-full h-full object-cover"/>
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
<a href="https://www.google.com" class="inline-block rounded-sm font-medium border border-solid cursor-pointer text-center transition-colors duration-200 text-base py-3 px-6 text-white bg-green-400 border-green-400 hover:bg-green-600 hover:border-green-600" >View Source</a>
</div>
</div>
</div>
<div class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img data-filter='pudding' src="https://images.pexels.com/photos/3026801/pexels-photo-3026801.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products w-full h-full object-cover"/>
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
<a href="https://www.google.com" class="inline-block rounded-sm font-medium border border-solid cursor-pointer text-center transition-colors duration-200 text-base py-3 px-6 text-white bg-green-400 border-green-400 hover:bg-green-600 hover:border-green-600" >View Source</a>
</div>
</div>
</div>
</div>
</section>
</main>
<script src="/app.js"></script>
</body>
</html>
So it seems you are looking to hide everything except what button you press.
I would first place a helper class to hide elements I want to filter out of the dom using classList to toggle the class with remove() and add()
I would move the dataset.filter attribute to the parent element .products rather than use the image as a reference and try to travel up the DOM to target the parent element.
Remove and rename your image class to products-img so it is different than the products parent element.
Use a callback to add to your eventListener that checks the targetBtn value or textContent run it through an forEach loop and if statement to handle the All button, showing all elements.
else we run a forEach over products, first hiding all elements and then matching our dataset.filter value using a conditional that checks if it is equal to e.target.textContent button.
See example below:
const buttons = document.querySelectorAll('.btn')
const products = document.querySelectorAll('.products')
function filterButtons(e) {
let targetBtn = e.target.textContent.toLowerCase()
targetBtn === 'all' ?
products.forEach(p => {
p.classList.contains('hide') ?
p.classList.remove('hide') : null
}) :
products.forEach(p => {
p.classList.add('hide')
p.dataset.filter === targetBtn ?
p.classList.remove('hide') : null
})
}
buttons.forEach(function(button) {
button.addEventListener('click', filterButtons)
})
.hide {
display: none;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://unpkg.com/tailwindcss#^2/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body class="bg-indigo-900 font-mono">
<nav class="mt-4 mb-10 text-white">
<div class="nav-bar">
<ul class="flex flex-row justify-center items-center space-x-8">
<li class=" transition transform duaration-100 hover:scale-110">
<a class="active btn filter-btn" href="#">All</a>
</li>
<li class="transition transform duaration-100 hover:scale-110">
<a class="btn filter-btn" href="#">Cake</a>
</li>
<li class="transition transform duaration-100 hover:scale-110">
<a class="btn filter-btn" href="#">Cookies</a>
</li>
<li class="transition transform duaration-100 hover:scale-110">
<a class="btn filter-btn" href="#">Donuts</a>
</li>
<li class="transition transform duaration-100 hover:scale-110">
<a class="btn filter-btn" href="#">Pudding</a>
</li>
</ul>
</div>
</nav>
<main>
<section class="container mx-auto flex flex-row justify-center items-center ">
<div class="grid grid-flow-row grid-cols-4 grid-rows-4 gap-10 parent">
<!-- cakes -->
<div data-filter='cake' class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img src="https://images.pexels.com/photos/291528/pexels-photo-291528.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products-img w-full h-full object-cover" />
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
View Source
</div>
</div>
</div>
<div data-filter='cake' class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img src="https://images.pexels.com/photos/1070850/pexels-photo-1070850.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products-img w-full h-full object-cover" />
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
View Source
</div>
</div>
</div>
<!-- cookies -->
<div data-filter='cookies' class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img src="https://images.pexels.com/photos/890577/pexels-photo-890577.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products-img w-full h-full object-cover" />
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
View Source
</div>
</div>
</div>
<div data-filter='cookies' class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img src="https://images.pexels.com/photos/1020585/pexels-photo-1020585.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products-img w-full h-full object-cover" />
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
View Source
</div>
</div>
</div>
<!-- donuts -->
<div data-filter='donuts' class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img src="https://images.pexels.com/photos/2955820/pexels-photo-2955820.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products-img w-full h-full object-cover" />
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
View Source
</div>
</div>
</div>
<div data-filter='donuts' class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img src="https://images.pexels.com/photos/3656118/pexels-photo-3656118.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products-img w-full h-full object-cover" />
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
View Source
</div>
</div>
</div>
<!-- pudding -->
<div data-filter='pudding' class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img src="https://images.pexels.com/photos/302468/pexels-photo-302468.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500" class="products-img w-full h-full object-cover" />
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
View Source
</div>
</div>
</div>
<div data-filter='pudding' class="w-72 products max-w-full border border-gray-300 rounded-sm bg-white">
<div class="w-full h-48">
<img src="https://images.pexels.com/photos/3026801/pexels-photo-3026801.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="products-img w-full h-full object-cover" />
</div>
<div class="p-6">
<h5 class="text-lg font-medium">Card title</h5>
<p class="mt-2">
Some simple text that describes what's going on in this very simple card.
</p>
<div class="mt-4 flex">
View Source
</div>
</div>
</div>
</div>
</section>
</main>
<script src="/app.js"></script>
</body>
</html>
Related
I am trying to create a chat like app using tailwind, and I can't seem to get overflow to function properly.
Instead of overflowing, it just stretches the box to fit all the contents.
Please see the code snippet or link below, at line 25 is where the container begins, the top container should span over 5/6 grid rows, and only overflow if the contents exceed the container!
<div class="grid h-screen w-screen grid-rows-6 gap-2 bg-neutral-900 p-1">
<div class="row-span-1 bg-neutral-800">
<div class="h-full w-full p-1">
<div class="mt-5">
<div class="flex flex-wrap justify-between px-5 w-full text-white">
<div>Com</div>
<div>3dub</div>
<div>Prof</div>
</div>
</div>
</div>
</div>
<div class="row-span-5 bg-neutral-800 p-1">
<div class="grid grid-cols-6 w-full h-full gap-1 p-1">
<div class="col-span-1 h-full">
<div class="h-full w-full p-1 bg-neutral-700">
<div class="text-white">Nodes</div>
</div>
</div>
<div class="col-span-5 h-full">
<div class="h-full w-full p-1 bg-neutral-700">
<div class="h-full w-full rounded-lg bg-neutral-600 p-4">
<div class="h-full w-full">
<div class="grid grid-rows-6 h-full w-full gap-y-1">
<div class="row-span-5 w-full rounded-lg bg-neutral-500">
<div class="h-full w-full min-h-0 rounded-lg bg-neutral-500 p-4">
<div class="flex flex-col h-full w-full overflow-y-scroll gap-y-2">
<div class="w-1/2 rounded-lg bg-neutral-400 p-4">Chat Msg</div>
<div class="w-1/2 rounded-lg bg-neutral-400 p-4">Chat Msg</div>
<div class="w-1/2 rounded-lg bg-neutral-400 p-4">Chat Msg</div>
<div class="w-1/2 rounded-lg bg-neutral-400 p-4">Chat Msg</div>
<div class="w-1/2 rounded-lg bg-neutral-400 p-4">Chat Msg</div>
<div class="w-1/2 rounded-lg bg-neutral-400 p-4">Chat Msg</div>
<div class="w-1/2 rounded-lg bg-neutral-400 p-4">Chat Msg</div>
<div class="w-1/2 rounded-lg bg-neutral-400 p-4">Chat Msg</div>
<div class="w-1/2 rounded-lg bg-neutral-400 p-4">Chat Msg</div>
</div>
</div>
</div>
<div class="row-span-1 w-full rounded-lg bg-neutral-500">
<div>Message</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
https://play.tailwindcss.com/2G6f2owRqQ
Edit: Included the wrong play.tailwindcss link
You can just add "overflow-hidden" to line 20.
In line 20 your code must be like below:
<div class="col-span-5 h-full overflow-hidden">
And if you change "overflow-y-scroll" to "overflow-y-auto" in line 28, scrollbar doesn't appear if messages heights don't exceed their parent div.
I am trying to resolve your problem. you can check here
This is my tailwind scroll bar and I want to change its height how can I do that? The below image shows its height. I cannot change the sm:h-96 can you suggest to me an method to change the height ?
{/** Chat Scroll View */}
<div class=" text-gray-500 bg-white rounded-lg border w-full max-w-xl sm:h-96 p-4 overflow-y-scroll scrollbar border-solid border-2 border-red-500">
<div class="space-y-1">
<div className="entry cursor-pointer transform hover:scale-105 duration-300 transition-transform bg-white mb-4 rounded p-4 flex shadow-md">
<div className="flex-2">
<div className="w-12 h-12 relative">
<img
className="w-12 h-12 rounded-full mx-auto"
src={"https://picsum.photos/300"}
alt="chat-user"
/>
<span className="absolute w-4 h-4 bg-green-400 rounded-full right-0 bottom-0 border-2 border-white"></span>
</div>
</div>
<div className="flex-1 px-2">
<div className="truncate w-32">
<span className="text-gray-800">Ryann Remo</span>
</div>
<div>
<small className="text-gray-600">Yea, Sure!</small>
</div>
</div>
<div className="flex-2 text-right">
<div>
<small className="text-gray-500">15 April</small>
</div>
<div>
<small className="text-xs bg-red-500 text-white rounded-full h-6 w-6 leading-6 text-center inline-block">
23
</small>
</div>
</div>
</div>
<div className="entry cursor-pointer transform hover:scale-105 duration-300 transition-transform bg-white mb-4 rounded p-4 flex shadow-md">
<div className="flex-2">
<div className="w-12 h-12 relative">
<img
className="w-12 h-12 rounded-full mx-auto"
src={"https://picsum.photos/300"}
alt="chat-user"
/>
<span className="absolute w-4 h-4 bg-green-400 rounded-full right-0 bottom-0 border-2 border-white"></span>
</div>
</div>
<div className="flex-1 px-2">
<div className="truncate w-32">
<span className="text-gray-800">Ryann Remo</span>
</div>
<div>
<small className="text-gray-600">Yea, Sure!</small>
</div>
</div>
<div className="flex-2 text-right">
<div>
<small className="text-gray-500">15 April</small>
</div>
<div>
<small className="text-xs bg-red-500 text-white rounded-full h-6 w-6 leading-6 text-center inline-block">
23
</small>
</div>
</div>
</div>
<div className="entry cursor-pointer transform hover:scale-105 duration-300 transition-transform bg-white mb-4 rounded p-4 flex shadow-md">
<div className="flex-2">
<div className="w-12 h-12 relative">
<img
className="w-12 h-12 rounded-full mx-auto"
src={"https://picsum.photos/500"}
alt="chat-user"
/>
<span className="absolute w-4 h-4 bg-gray-400 rounded-full right-0 bottom-0 border-2 border-white"></span>
</div>
</div>
<div className="flex-1 px-2">
<div className="truncate w-32">
<span className="text-gray-800">Karp Bonolo</span>
</div>
<div>
<small className="text-gray-600">Yea, Sure!</small>
</div>
</div>
<div className="flex-2 text-right">
<div>
<small className="text-gray-500">15 April</small>
</div>
<div>
<small className="text-xs bg-red-500 text-white rounded-full h-6 w-6 leading-6 text-center inline-block">
10
</small>
</div>
</div>
</div>
<div className="entry cursor-pointer transform hover:scale-105 duration-300 transition-transform bg-white mb-4 rounded p-4 flex shadow-md">
<div className="flex-2">
<div className="w-12 h-12 relative">
<img
className="w-12 h-12 rounded-full mx-auto"
src={"https://picsum.photos/500"}
alt="chat-user"
/>
<span className="absolute w-4 h-4 bg-gray-400 rounded-full right-0 bottom-0 border-2 border-white"></span>
</div>
</div>
<div className="flex-1 px-2">
<div className="truncate w-32">
<span className="text-gray-800">Karp Bonolo</span>
</div>
<div>
<small className="text-gray-600">Yea, Sure!</small>
</div>
</div>
<div className="flex-2 text-right">
<div>
<small className="text-gray-500">15 April</small>
</div>
<div>
<small className="text-xs bg-red-500 text-white rounded-full h-6 w-6 leading-6 text-center inline-block">
10
</small>
</div>
</div>
</div>
<div className="entry cursor-pointer transform hover:scale-105 duration-300 transition-transform bg-white mb-4 rounded p-4 flex shadow-md border-l-4 border-red-500">
<div className="flex-2">
<div className="w-12 h-12 relative">
<img
className="w-12 h-12 rounded-full mx-auto"
src={"https://picsum.photos/200"}
alt="chat-user"
/>
<span className="absolute w-4 h-4 bg-gray-400 rounded-full right-0 bottom-0 border-2 border-white"></span>
</div>
</div>
<div className="flex-1 px-2">
<div className="truncate w-32">
<span className="text-gray-800">Mercedes Yemelyan</span>
</div>
<div>
<small className="text-gray-600">Yea, Sure!</small>
</div>
</div>
<div className="flex-2 text-right">
<div>
<small className="text-gray-500">15 April</small>
</div>
</div>
</div>
<div className="entry cursor-pointer transform hover:scale-105 duration-300 transition-transform bg-white mb-4 rounded p-4 flex shadow-md">
<div className="flex-2">
<div className="w-12 h-12 relative">
<img
className="w-12 h-12 rounded-full mx-auto"
src={"https://picsum.photos/600"}
alt="chat-user"
/>
<span className="absolute w-4 h-4 bg-gray-400 rounded-full right-0 bottom-0 border-2 border-white"></span>
</div>
</div>
<div className="flex-1 px-2">
<div className="truncate w-32">
<span className="text-gray-800">Cadi Kajetán</span>
</div>
<div>
<small className="text-gray-600">Yea, Sure!</small>
</div>
</div>
<div className="flex-2 text-right">
<div>
<small className="text-gray-500">15 April</small>
</div>
</div>
</div>
<div className="entry cursor-pointer transform hover:scale-105 duration-300 transition-transform bg-white mb-4 rounded p-4 flex shadow-md">
<div className="flex-2">
<div className="w-12 h-12 relative">
<img
className="w-12 h-12 rounded-full mx-auto"
src={"https://picsum.photos/650"}
alt="chat-user"
/>
<span className="absolute w-4 h-4 bg-gray-400 rounded-full right-0 bottom-0 border-2 border-white"></span>
</div>
</div>
<div className="flex-1 px-2">
<div className="truncate w-32">
<span className="text-gray-800">Rina Samuel</span>
</div>
<div>
<small className="text-gray-600">Yea, Sure!</small>
</div>
</div>
<div className="flex-2 text-right">
<div>
<small className="text-gray-500">15 April</small>
</div>
</div>
</div>
</div>
</div>
{/** Chat Scroll View */}
If you want to change the height based on your preference you can use an arbitrary value like h-[120px] or h-[30rem] or h-[180px] for example. you can change the value inside the square brackets according to the height you want.
You can learn more about arbitrary values in the tailwind documentation here:
https://tailwindcss.com/docs/adding-custom-styles#using-arbitrary-values
I am trying to achieve the animation on cards when they are scrolled as shown in the following link .
In the below example, I want the animation done in the right-hand side cards ( fade off when they are out the view ).
LINK HERE
I had used the whileInView attribute of framer motion, from Docs. But it not what I expected.
Below is my code, but it is very long. However you can take simply 6 cards in 4x2 (4 rows, 2 cols) as an example.
import React from "react";
import imgurl1s from "../public/mssmall.png";
import imgurl1l from "../public/mslarge.png";
import Image from "next/image";
import {
SiBootstrap,
SiFramer,
SiJavascript,
SiLichess,
SiMongodb,
SiNextdotjs,
SiPostman,
SiReact,
SiRedux,
SiTailwindcss,
} from "react-icons/si";
import { FaNodeJs, FaEye, FaHtml5, FaCss3, FaSpotify } from "react-icons/fa";
import { HiCode } from "react-icons/hi";
import { AiOutlineApi } from "react-icons/ai";
import { motionValue } from "framer-motion";
const Projects = () => {
const currentOffSetY = motionValue(0);
return (
<>
<div className="min-h-full">
<div className=" mx-auto shadow container">
<div className="px-4 py-6 sm:px-0">
<div className="p-5 border-2 border-red-400/20 flex flex-col lg:flex-col items-center justify-center ">
<div className="p-2 sm:p-10 flex flex-col lg:flex-row items-center space-y-3 lg:space-y-0 lg:space-x-16 justify-center">
{/* card1 mschatapp*/}
<div className="card w-full h-full bg-transparent hover:bg-gradient-to-r hover: hover:to-[#b2eff7] transition hover:rounded-lg hover:drop-shadow-3xl hover:ease-in-oute ">
<div
className="transition p-2 flex flex-col items-center bg-gradient-to-r from-[#ffa0ae,5%] to-[#b2eff7] rounded-lg border shadow-md sm:flex-row md:max-w-6xl md:max-h-96 hover:cursor-pointer hover:from-[#ffa0ae,5%] hover:to-[#b2eff7] hover:transition hover:duration-500 ease-in-out opacity-90 hover:opacity-100"
>
<div className="block sm:hidden">
<Image
height={350}
width={700}
className="object-cover rounded-t-lg "
src={imgurl1l}
alt=""
/>
</div>
<div className="hidden sm:block">
<Image
width="500%"
height="1000%"
className="object-cover rounded-t-lg md:h-auto md:w-48 md:rounded-none md:rounded-l-lg"
src={imgurl1s}
alt=""
/>
</div>
<div className="flex flex-col justify-between p-3 leading-normal ">
<h5 className="mb-2 text-lg sm:text-2xl font-bold tracking-tight text-gray-900 ">
ms-chatApp
</h5>
<p className="mb-3 font-normal text-xsm sm:text-base text-justify text-gray-700 ">
ms-chat-app is the macro version of ms-teams where you
can form groups and can message & share images with
different people. You can also customize the UI by
yourself.
</p>
<hr className="m-auto text-black bg-black" />
<h3 className="text-sm sm:text-base text-black font-semibold">
Technologies
</h3>
<div className="text-black flex flex-row space-x-3 py-2">
<span>
<SiReact className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl" />
</span>
<span>
<SiMongodb className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl" />
</span>
<span>
<FaNodeJs className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl " />
</span>
<span>
<SiPostman className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl " />
</span>
</div>
<div className="flex flex-row items-center justify-between w-full lg:w-4/5 mt-3 lg:mt-5 mx-auto bg-slate-300 rounded-lg">
<button
className="bg-indigo-900 text-sm sm:text-base text-white p-1 px-2 rounded-md hover:bg-indigo-800 hover:cursor-pointer transition duration-50 ease-in-out"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
title="See Live"
>
<a
href="#"
target="_blank"
>
<FaEye size={18} />
</a>
</button>
<button
className="bg-indigo-900 text-sm sm:text-base text-white p-1 px-2 rounded-md hover:bg-indigo-800 hover:cursor-pointer transition duration-50 ease-in-out"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
title="See Code"
>
<a
href="#"
target="_blank"
>
<HiCode size={18} />
</a>
</button>
</div>
</div>
</div>
</div>
{/* card2 */}
<div className="card w-full h-full bg-transparent hover:bg-gradient-to-r hover: hover:to-[#b2eff7] transition hover:rounded-lg hover:drop-shadow-3xl hover:ease-in-oute ">
<div
className="transition p-2 flex flex-col items-center bg-gradient-to-r from-[#ffa0ae,5%] to-[#b2eff7] rounded-lg border shadow-md sm:flex-row md:max-w-6xl md:max-h-96 hover:cursor-pointer hover:from-[#ffa0ae,5%] hover:to-[#b2eff7] hover:transition hover:duration-500 ease-in-out opacity-90 hover:opacity-100"
>
<div className="block sm:hidden">
<Image
height={350}
width={700}
className="object-cover rounded-t-lg "
src={imgurl1l}
alt=""
/>
</div>
<div className="hidden sm:block">
<Image
width="500%"
height="1000%"
className="object-cover rounded-t-lg md:h-auto md:w-48 md:rounded-none md:rounded-l-lg"
src={imgurl1s}
alt=""
/>
</div>
<div className="flex flex-col justify-between p-3 leading-normal ">
<h5 className="mb-2 text-lg sm:text-2xl font-bold tracking-tight text-gray-900 ">
ms-chatApp
</h5>
<p className="mb-3 font-normal text-xsm sm:text-base text-justify text-gray-700 ">
ms-chat-app is the macro version of ms-teams where you
can form groups and can message & share images with
different people. You can also customize the UI by
yourself.
</p>
<hr className="m-auto text-black bg-black" />
<h3 className="text-sm sm:text-base text-black font-semibold">
Technologies
</h3>
<div className="text-black flex flex-row space-x-3 py-2">
<span>
<SiReact className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl" />
</span>
<span>
<SiMongodb className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl" />
</span>
<span>
<FaNodeJs className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl " />
</span>
<span>
<SiPostman className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl " />
</span>
</div>
<div className="flex flex-row items-center justify-between w-full lg:w-4/5 mt-3 lg:mt-5 mx-auto bg-slate-300 rounded-lg">
<button
className="bg-indigo-900 text-sm sm:text-base text-white p-1 px-2 rounded-md hover:bg-indigo-800 hover:cursor-pointer transition duration-50 ease-in-out"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
title="See Live"
>
<a
href="#"
target="_blank"
>
<FaEye size={18} />
</a>
</button>
<button
className="bg-indigo-900 text-sm sm:text-base text-white p-1 px-2 rounded-md hover:bg-indigo-800 hover:cursor-pointer transition duration-50 ease-in-out"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
title="See Code"
>
<a
href="#"
target="_blank"
>
<HiCode size={18} />
</a>
</button>
</div>
</div>
</div>
</div>
</div>
<div className="p-2 sm:p-10 flex flex-col lg:flex-row items-center space-y-3 lg:space-y-0 lg:space-x-16 justify-center">
{/* card3 */}
<div className="card w-full h-full bg-transparent hover:bg-gradient-to-r hover: hover:to-[#b2eff7] transition hover:rounded-lg hover:drop-shadow-3xl hover:ease-in-oute ">
<div
className="transition p-2 flex flex-col items-center bg-gradient-to-r from-[#ffa0ae,5%] to-[#b2eff7] rounded-lg border shadow-md sm:flex-row md:max-w-6xl md:max-h-96 hover:cursor-pointer hover:from-[#ffa0ae,5%] hover:to-[#b2eff7] hover:transition hover:duration-500 ease-in-out opacity-90 hover:opacity-100"
>
<div className="block sm:hidden">
<Image
height={350}
width={700}
className="object-cover rounded-t-lg "
src={imgurl1l}
alt=""
/>
</div>
<div className="hidden sm:block">
<Image
width="500%"
height="1000%"
className="object-cover rounded-t-lg md:h-auto md:w-48 md:rounded-none md:rounded-l-lg"
src={imgurl1s}
alt=""
/>
</div>
<div className="flex flex-col justify-between p-3 leading-normal ">
<h5 className="mb-2 text-lg sm:text-2xl font-bold tracking-tight text-gray-900 ">
ms-chatApp
</h5>
<p className="mb-3 font-normal text-xsm sm:text-base text-justify text-gray-700 ">
ms-chat-app is the macro version of ms-teams where you
can form groups and can message & share images with
different people. You can also customize the UI by
yourself.
</p>
<hr className="m-auto text-black bg-black" />
<h3 className="text-sm sm:text-base text-black font-semibold">
Technologies
</h3>
<div className="text-black flex flex-row space-x-3 py-2">
<span>
<SiReact className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl" />
</span>
<span>
<SiMongodb className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl" />
</span>
<span>
<FaNodeJs className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl " />
</span>
<span>
<SiPostman className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl " />
</span>
</div>
<div className="flex flex-row items-center justify-between w-full lg:w-4/5 mt-3 lg:mt-5 mx-auto bg-slate-300 rounded-lg">
<button
className="bg-indigo-900 text-sm sm:text-base text-white p-1 px-2 rounded-md hover:bg-indigo-800 hover:cursor-pointer transition duration-50 ease-in-out"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
title="See Live"
>
<a
href="#"
target="_blank"
>
<FaEye size={18} />
</a>
</button>
<button
className="bg-indigo-900 text-sm sm:text-base text-white p-1 px-2 rounded-md hover:bg-indigo-800 hover:cursor-pointer transition duration-50 ease-in-out"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
title="See Code"
>
<a
href="#"
target="_blank"
>
<HiCode size={18} />
</a>
</button>
</div>
</div>
</div>
</div>
{/* card4 /}
<div className="card w-full h-full bg-transparent hover:bg-gradient-to-r hover: hover:to-[#b2eff7] transition hover:rounded-lg hover:drop-shadow-3xl hover:ease-in-oute ">
<div
className="transition p-2 flex flex-col items-center bg-gradient-to-r from-[#ffa0ae,5%] to-[#b2eff7] rounded-lg border shadow-md sm:flex-row md:max-w-6xl md:max-h-96 hover:cursor-pointer hover:from-[#ffa0ae,5%] hover:to-[#b2eff7] hover:transition hover:duration-500 ease-in-out opacity-90 hover:opacity-100"
>
<div className="block sm:hidden">
<Image
height={350}
width={700}
className="object-cover rounded-t-lg "
src={imgurl1l}
alt=""
/>
</div>
<div className="hidden sm:block">
<Image
width="500%"
height="1000%"
className="object-cover rounded-t-lg md:h-auto md:w-48 md:rounded-none md:rounded-l-lg"
src={imgurl1s}
alt=""
/>
</div>
<div className="flex flex-col justify-between p-3 leading-normal ">
<h5 className="mb-2 text-lg sm:text-2xl font-bold tracking-tight text-gray-900 ">
ms-chatApp
</h5>
<p className="mb-3 font-normal text-xsm sm:text-base text-justify text-gray-700 ">
ms-chat-app is the macro version of ms-teams where you
can form groups and can message & share images with
different people. You can also customize the UI by
yourself.
</p>
<hr className="m-auto text-black bg-black" />
<h3 className="text-sm sm:text-base text-black font-semibold">
Technologies
</h3>
<div className="text-black flex flex-row space-x-3 py-2">
<span>
<SiReact className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl" />
</span>
<span>
<SiMongodb className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl" />
</span>
<span>
<FaNodeJs className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl " />
</span>
<span>
<SiPostman className="hover:text-purple-900 hover:border-[1px] hover:border-purple-900 hover:scale-150 hover:rounded-xl " />
</span>
</div>
<div className="flex flex-row items-center justify-between w-full lg:w-4/5 mt-3 lg:mt-5 mx-auto bg-slate-300 rounded-lg">
<button
className="bg-indigo-900 text-sm sm:text-base text-white p-1 px-2 rounded-md hover:bg-indigo-800 hover:cursor-pointer transition duration-50 ease-in-out"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
title="See Live"
>
<a
href="#"
target="_blank"
>
<FaEye size={18} />
</a>
</button>
<button
className="bg-indigo-900 text-sm sm:text-base text-white p-1 px-2 rounded-md hover:bg-indigo-800 hover:cursor-pointer transition duration-50 ease-in-out"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
title="See Code"
>
<a
href="#"
target="_blank"
>
<HiCode size={18} />
</a>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</>
);
};
export default Projects;
I want to comment dynamically on a video with jQuery, but when I comment on what I'm doing, the old comment changes and all comments receive the same text. The value I get from the input is written to all comments. How can I fix this?
$(document).ready(function() {
$("#addCommentBtn").click(function() {
var comment = $("#commentText").val();
if (comment === "") {
$("#error-msg").fadeIn();
setTimeout(function() {
$("#error-msg").fadeOut();
}, 3000);
} else {
$('<li class="w-full comment mt-4"><div class="w-full md:w-1/2 comment flex flex-col"><div class="flex gap-4 items-center text-lg font-bold"><img src="assets/media/svg/NoPath - Kopya (75).png" class="rounded-full" alt=""><h1>André Potchinka</h1></div><div class="ml-16 flex flex-col justify-center"><div class=" mt-2 flex gap-1 items-center"><h1 class="comment-content text-gray-500 font-bold"></h1><span class="flex gap-2 -mt-1"><i class="fas fa-thumbs-up" aria-hidden="true"></i>0</span><span class="flex gap-2 -mt-1"><i class="fas fa-thumbs-down" aria-hidden="true"></i>0</span></div><div class="w-full flex flex-col"><input type="text" class="responseText border-b focus:outline-none bg-transparent mt-4" placeholder="Please login to leave a comment..."><ul class="responses p-4 flex flex-col gap-2"> </ul><button class="responseBtn text-right mt-2 text-gray-500">Answer</button></div></div></div></li>').appendTo(".comments");
$(".comment-content").text(comment);
$("#commentText").val("");
$("#valid-msg").fadeIn();
setTimeout(function() {
$("#valid-msg").fadeOut();
}, 3000);
}
});
});
<link href="https://unpkg.com/tailwindcss#^2/dist/tailwind.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="comments" class="hidden p-4">
<div class="container mx-auto">
<div class="w-full flex gap-4">
<img src="assets/media/svg/Group 199.png" alt="">
<input type="text" required id="commentText" class="pt-4 flex-1 focus:outline-none border-b border-gray-500 py-1 px-2 bg-transparent" placeholder="Please login to leave a comment...">
</div>
<div class="w-full flex gap-4 justify-end items-center mt-4">
Cancel
<button id="addCommentBtn" class="focus:outline-none bg-black px-6 border border-black py-1 rounded-full text-gray-500 flex items-center pt-3">Comment</button>
</div>
<ul class="w-full comments">
<li class="w-full comment mt-4">
<div class="w-full md:w-1/2 comment flex flex-col">
<div class="flex gap-4 items-center text-lg font-bold">
<img src="assets/media/svg/NoPath - Kopya (75).png" class="rounded-full" alt="">
<h1>André Potchinka</h1>
</div>
<div class="ml-16 flex flex-col justify-center">
<div class=" mt-2 flex gap-1 items-center">
<h1 class="text-gray-500 font-bold">Nice work, congragulations.</h1>
<span class="flex gap-2 -mt-1"><i class="fas fa-thumbs-up"></i>0</span>
<span class="flex gap-2 -mt-1"><i class="fas fa-thumbs-down"></i>0</span>
</div>
<div class="w-full flex flex-col">
<input type="text" class="responseText border-b focus:outline-none bg-transparent mt-4" placeholder="Please login to leave a comment...">
<ul class="responses p-4 flex flex-col gap-2 text-gray-500">
<li>Yoruma yanıt verildi :)</li>
</ul>
<div class="flex justify-end">
<button class="responseBtn mt-2 text-gray-500 w-24 text-center">Answer</button>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
With the selector .comment-content, you are selecting all the elements with that class, so of course all comments' text content will be overwritten. Save your new element into a variable and restrict the class selector on that new element instead:
$(document).ready(function() {
$("#addCommentBtn").click(function() {
var comment = $("#commentText").val();
if (comment === "") {
$("#error-msg").fadeIn();
setTimeout(function() {
$("#error-msg").fadeOut();
}, 3000);
} else {
let newComment = $('<li class="w-full comment mt-4"><div class="w-full md:w-1/2 comment flex flex-col"><div class="flex gap-4 items-center text-lg font-bold"><img src="assets/media/svg/NoPath - Kopya (75).png" class="rounded-full" alt=""><h1>André Potchinka</h1></div><div class="ml-16 flex flex-col justify-center"><div class=" mt-2 flex gap-1 items-center"><h1 class="comment-content text-gray-500 font-bold"></h1><span class="flex gap-2 -mt-1"><i class="fas fa-thumbs-up" aria-hidden="true"></i>0</span><span class="flex gap-2 -mt-1"><i class="fas fa-thumbs-down" aria-hidden="true"></i>0</span></div><div class="w-full flex flex-col"><input type="text" class="responseText border-b focus:outline-none bg-transparent mt-4" placeholder="Please login to leave a comment..."><ul class="responses p-4 flex flex-col gap-2"> </ul><button class="responseBtn text-right mt-2 text-gray-500">Answer</button></div></div></div></li>').appendTo(".comments");
$(".comment-content", newComment).text(comment);
$("#commentText").val("");
$("#valid-msg").fadeIn();
setTimeout(function() {
$("#valid-msg").fadeOut();
}, 3000);
}
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="comments" class="hidden p-4">
<div class="container mx-auto">
<div class="w-full flex gap-4">
<img src="assets/media/svg/Group 199.png" alt="">
<input type="text" required id="commentText" class="pt-4 flex-1 focus:outline-none border-b border-gray-500 py-1 px-2 bg-transparent" placeholder="Please login to leave a comment...">
</div>
<div class="w-full flex gap-4 justify-end items-center mt-4">
Cancel
<button id="addCommentBtn" class="focus:outline-none bg-black px-6 border border-black py-1 rounded-full text-gray-500 flex items-center pt-3">Comment</button>
</div>
<ul class="w-full comments">
<li class="w-full comment mt-4">
<div class="w-full md:w-1/2 comment flex flex-col">
<div class="flex gap-4 items-center text-lg font-bold">
<img src="assets/media/svg/NoPath - Kopya (75).png" class="rounded-full" alt="">
<h1>André Potchinka</h1>
</div>
<div class="ml-16 flex flex-col justify-center">
<div class=" mt-2 flex gap-1 items-center">
<h1 class="text-gray-500 font-bold">Nice work, congragulations.</h1>
<span class="flex gap-2 -mt-1"><i class="fas fa-thumbs-up"></i>0</span>
<span class="flex gap-2 -mt-1"><i class="fas fa-thumbs-down"></i>0</span>
</div>
<div class="w-full flex flex-col">
<input type="text" class="responseText border-b focus:outline-none bg-transparent mt-4" placeholder="Please login to leave a comment...">
<ul class="responses p-4 flex flex-col gap-2 text-gray-500">
<li>Yoruma yanıt verildi :)</li>
</ul>
<div class="flex justify-end">
<button class="responseBtn mt-2 text-gray-500 w-24 text-center">Answer</button>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
currently I'm working on bulma css frameworks. I'm making contact us page but some unwanted space is there. I tried a lot but don't know how to remove that?
I just shared image of what is the problem below.
This is Image
This is Code
<section class="p-5">
<div class="columns is-desktop box has-background-grey-light m-0">
<div class="column">
<div class="has-text-centered">
<div class="box">
<span class="icon m-4">
<i class="fas fa-map-marker-alt fa-2x has-text-primary"></i>
</span>
<p class="is-size-5 has-text-weight-medium has-text-grey">Our Address</p>
<p class="m-2">A108 Adam Street, New York, NY 535022</p>
</div>
<div class="columns is-desktop m-0">
<div class="column box">
<span class="icon m-4">
<i class="fas fa-map-marker-alt fa-2x has-text-primary"></i>
</span>
<p class="is-size-5 has-text-weight-medium has-text-grey">Email Us</p>
<p class="m-2">info#example.com
contact#example.com</p>
</div>
<div class="column box ml-5">
<span class="icon m-4">
<i class="fas fa-map-marker-alt fa-2x has-text-primary"></i>
</span>
<p class="is-size-5 has-text-weight-medium has-text-grey">Call Us</p>
<p class="m-2">+1 5589 55488 55<br />
+1 6678 254445 41</p>
</div>
</div>
</div>
</div>
<div class="column">
<div class="box">
</div>
</div>
</div>
</section>
try only with TailwindCSS like this,
<section class="flex w-full flex-col bg-gray-300 text-xl">
<div class="flex flex-col items-center bg-white m-10 rounded-xl p-6 space-y-2">
<img class="w-10 h-10" src="https://img.icons8.com/fluent/48/000000/map-pin.png" />
<span class="font-bold">Our Address</span>
<div class="flex flex-col md:flex-row items-center">
<span> A108 Adam Street,</span>
<span>New York, NY 535022</span>
</div>
</div>
<div class="flex flex-col md:flex-row justify-around w-full">
<div class="flex flex-col items-center bg-white m-10 rounded-xl p-6 space-y-2 w-auto md:w-full">
<img class="w-10 h-10" src="https://img.icons8.com/fluent/48/000000/map-pin.png" />
<span class="font-bold">Email Us</span>
<span>info#example.com</span>
<span>contact#example.com</span>
</div>
<div class="flex flex-col items-center bg-white m-10 rounded-xl p-6 space-y-2 w-auto md:w-full">
<img class="w-10 h-10" src="https://img.icons8.com/fluent/48/000000/map-pin.png" />
<span class="font-bold">Call Us</span>
<span>+1 5589 55488 55</span>
<span>+1 6678 254445 41</span>
</div>
</div>
</section>
Check on the Tailwind Play