skip to Main Content

The background image is not showing. I also tried "bg-[url(‘/image/example.jpeg’)"

tailwind.config.js

  theme: {
    extend: {
      colors: {
        darkBlue: "#0D1A32",
      },
      backgroundImage: {
        "hero-image": "url('/app/images/lentcm93p_1.jpg')",
      },
    },
  },
  plugins: [],
};

Page.js

export default function Home() {
  return (
    <>
      <div className="h-[455px] w-full bg-hero-image bg-cover">
      </div>
    </>
  );
}

2

Answers


  1. Maybe file /app/images/lentcm93p_1.jpg doesn’t exist on your project

    Login or Signup to reply.
  2. It may be because of the wrong reference. Usually /app wouldn’t be used.

    Try changing

    "hero-image": "url('/app/images/lentcm93p_1.jpg')",
    

    to

    "hero-image": "url('images/lentcm93p_1.jpg')",
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search