I am using Next JS 14 and Tailwind CSS
If I use fill this is code:
"use client";
import React from "react";
import { motion } from "framer-motion";
import Image from "next/image";
const Photo = () => {
return (
<div className="w-full h-full relative">
<motion.div className="relative">
<div className="w-[298px] h-[298px] xl:w-[498px] xl:h-[498px] mix-blend-lighten border-4 relative">
<Image
src="/assets/images/photo.png"
priority
quality={100}
fill
sizes="300px"
alt="main"
className="object-contain"
/>
</div>
</motion.div>
</div>
);
};
export default Photo;
But its image is not visible If I use width and height its working this is the code :
"use client";
import React from "react";
import { motion } from "framer-motion";
import Image from "next/image";
const Photo = () => {
return (
<div className="w-full h-full relative">
<motion.div className="relative">
<div className="w-[298px] h-[298px] xl:w-[498px] xl:h-[498px] mix-blend-lighten border-4 relative bg-gray-200">
<Image
src="/assets/images/photo.png"
priority
quality={100}
width={298}
height={298}
alt="main"
className="object-contain"
/>
</div>
</motion.div>
</div>
);
};
export default Photo;
What is the reason for this please help me to fix that, cant I use fill property here ?