#Pattern background not working as expected

2 messages · Page 1 of 1 (latest)

burnt osprey
#

So i am trying to have a pattern background however it is not filling the entire page, any help is appreciated

import React from 'react';

type Props = {};

const Home = (props: Props) => {
  return (
    <div className="relative flex flex-col items-center justify-center h-screen lg:w-1/3 xl:w-1/3 md:w-1/3 sm:w-full w-full">
      {/* Background pattern */}
      <div className="absolute inset-0 z-0 bg-gradient-to-b from-gray-100 to-gray-200">
        <svg
          xmlns="http://www.w3.org/2000/svg"
          viewBox="0 0 100 100"
          preserveAspectRatio="xMinYMin meet"
          className="h-full w-full"
        >
          <defs>
            <pattern
              id="pattern"
              patternUnits="userSpaceOnUse"
              width="25"
              height="25"
            >
              <image
                href="/assets/images/backgroundPattern.svg"
                x="0"
                y="0"
                width="25"
                height="25"
                preserveAspectRatio="xMidYMid slice"
              />
            </pattern>
          </defs>
          <rect x="0" y="0" width="100%" height="100%" fill="url(#pattern)" />
        </svg>
      </div>
      {/* Content */}
      <div className="relative z-10 bg-white rounded-lg shadow-lg p-8 h-full m-20 mx-6">
        <h1 className="text-3xl font-bold text-black">Welcome to the Home Page</h1>
        <p className="text-lg text-black">This is a simple home page</p>
      </div>
    </div>
  );
};

export default Home;
fierce citrusBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)