I ran into a problem that if you add a scroll, it does not allow you to show content outside the scope. Preliminary search for a solution shows that it is in principle not possible to implement now?
How it looks
Instead of a tooltip, there can be anything else. If you remove the scroll, then there is no problem, it is also clear how to use "relative" and "absolute". The problem is with the scroll.
My code:
import { Tooltip } from "../tooltips/Tooltip";
function Dialog() {
return (
<>
{/*bg*/}
<div class="fixed inset-0 z-0 bg-white heropattern-topography-slate-400"></div>
{/*dialog*/}
<div class="fixed inset-0 z-0 flex">
<div class=" relative m-auto flex h-96 max-h-full w-4/5 flex-col rounded border bg-purple-400 p-[8px]">
{/*header*/}
<div>Header</div>
{/*content*/}
<div class=" flex overflow-y-auto bg-orange-400">
<div className="">
<div className="z-20">
<Tooltip
// topLeft={true}
bottomRight={true}
text={"It's your tooltip"}
>
<div className="flex w-fit bg-lime-400 p-4 hover:overflow-visible">
tooltip
</div>
</Tooltip>
</div>
content
<br />
content
<br /> content
<Tooltip topRight={true} text={"It's your tooltip"}>
<div className="flex w-fit bg-lime-400 p-4">tooltip</div>
</Tooltip>
content
<br /> content
<br />
content
<br /> content
<br />
content
<br /> content
<br />
content
<br /> content
<br />
content
<br />
</div>
</div>
{/*footer*/}
<div>Footer</div>
</div>
</div>
</>
);
}
export { Dialog };
Related
<>
<div
className={
"border-2 border-amber-400 flex-shrink-0 h-[300px] w-[200px] rounded-lg"
}
>
<img
src={img}
// alt="Background Image"
className="object-cover h-[200px] w-[200px]"
/>
<div className="h-[30px]">ajjidf</div>
<div className="h-[30px]">sdfjio</div>
<button className="bg-blue-500 hover:bg-blue-700 text-white font-bold w-[196px] h-[50px] rounded-lg">
View Image
</button>
</div>
</>
align-stretch does not do the job and "h-full" just gets off the space.
I want the button to cover all the white space under the button.
I want to put a contain around my page so that on very large screens the content stays in the middle of the screen.
But I have a background image i want to still show over the container. Does anyone know how I would achieve this?
export const PreviewScreen: React.FC = () => {
return (
<div className="sm:ml-0 xl:container xl:mx-auto">
<div className="text-mainText font-Montserrat">
<PreviewPageNav />
<div className="ml-2">
<div className="ml-36 h-14">
<div className="bg-landing-background bg-no-repeat bg-14 bg-center-2 h-14 bg-center-2">
<p className="text-5xl font-Montserrat">
One workspace <br /> Every team
</p>
</div>
</div>
{/* <PackageCards /> */}
{/* <StoreContact /> */}
</div>
</div>
</div>
);
};
I want the image to go to the edge of the screen and not get cut off.
The <div> that has the container will need a parent <div> that is full width and has the image in it.
Here is an example
<div class="grid bg-center bg-[url('https://images.unsplash.com/photo-1554629947-334ff61d85dc?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=2560&h=2560&q=80')] bg-cover">
<div>
<div class="container m-5 mx-auto bg-slate-200 p-1 h-96">Hello World</div>
</div>
</div>
https://play.tailwindcss.com/Rgrs0CG87b
I am trying to centre a div present inside a CSS Grid horizontally and vertically. I am using TailwindCSS v3. Using mx-auto, I can align the content horizontally, but align-middle along with flexbox isn't showing any results. I am attaching the code snippet below.
<div className="grid grid-cols-6 mb-2">
<div className="col-span-1">
<div className="flex align-middle">
<ImLocation className="text-lg text-black mx-auto" />
</div>
</div>
<div className="col-span-5">
<p className="text-sm md:text-base text-black">
Address Line 1, <br />
Address Line 2, <br />
Address Line 3
</p>
</div>
</div>
The issue here is that the first inner-div (with class col-span-1) has a smaller height than the other div. I want that div to align in the centre with the other div vertically. ImLocation is a react icon that I have used.
Use items-center and justify-center like below:
<div className="grid grid-cols-6 mb-2">
<div className="col-span-1">
<div className="flex flex-row items-center justify-center">
<ImLocation className="text-lg text-black mx-auto" />
</div>
</div>
<div className="col-span-5">
<p className="text-sm md:text-base text-black">
Address Line 1, <br />
Address Line 2, <br />
Address Line 3
</p>
</div>
</div>
Using Tailwind With ReactJS I'm trying to align an image to the center but I can't, this is my code:
<div class="grid md:grid-cols-2 gap-1 place-content-center">
<div className="hidden md:block my-10 md:ml-10 shadow rounded-sm">
<img
src={ Logo }
alt= "Logo"
className="object-none object-center"
/>
</div>
<form className="my-10 md:mr-10 bg-white shadow rounded-sm px-10 py-5">
...
</form>
</div>
Here is a screenshot of the result:
Make the div parent flex instead of block, add justify-center
like this :
<div class="grid place-content-center gap-1 md:grid-cols-2">
<div class="hidden md:inline-flex my-10 md:ml-10 shadow rounded-sm w-full justify-center">
<img src="https://picsum.photos/200" alt="Logo" class="object-none object-center" />
</div>
<form class="my-10 md:mr-10 bg-white shadow rounded-sm px-10 py-5">...</form>
</div>
have a look https://play.tailwindcss.com/lQAKX22Qf7
Or you could just add mx-auto to img
Okay so I suppose you just want to align the image to the center of that grid item, in that case you can just simply add justify-self-center class into the div that contain the image, something like this:
<div className="grid md:grid-cols-2 gap-1 place-content-center">
<div className="hidden md:block my-10 md:ml-10 shadow rounded-sm justify-self-center">
<img
src={ Logo }
alt= "Logo"
className="object-none object-center"
/>
</div>
<form className="my-10 md:mr-10 bg-white shadow rounded-sm px-10 py-5">
...
</form>
</div>
Also I noticed there's a typo problem at the outer div, it should be className instead of class.
Hope this helps
you need to add m-auto to image. you can see here
<div class="grid place-content-center gap-1 grid-cols-2">
<div class="my-10 shadow rounded-sm w-full justify-center">
<img src="https://picsum.photos/200" alt="Logo" class="object-none object-center m-auto" />
</div>
<form class="my-10 bg-white shadow rounded-sm px-10 py-5">...</form>
</div>
i'm learning nextjs and tailwind css.
I want to fill half width using next/image.
but, it's using full width
function Slider() {
return (
<div className="w-full h-screen flex relative">
<div className="Arrow left-[10px]">
<ArrowLeftOutlined />
</div>
<div className="Wrapper h-full flex">
<div className=" w-screen h-screen flex items-center">
<div className="ImgContainer h-full flex-1 ">
<Image
className=""
src=""
layout="fill"
/>
</div>
<div className="Info flex-1 p-[50px]"></div>
</div>
</div>
<div className="Arrow right-[10px]">
<ArrowRightOutlined />
</div>
</div>
);
}
This is my code, plz let me know..
Set position: relative for the wrapping div
function Slider() {
return (
<div className="w-full h-screen flex relative">
<div className="Arrow left-[10px]">
<ArrowLeftOutlined />
</div>
<div className="Wrapper h-full flex">
<div className=" w-screen h-screen flex items-center">
<div className="ImgContainer h-full flex-1 relative">
<Image
className=""
src=""
layout="fill"
/>
</div>
<div className="Info flex-1 p-[50px]"></div>
</div>
</div>
<div className="Arrow right-[10px]">
<ArrowRightOutlined />
</div>
</div>
);
}