Hey it's my first time posting and I am a pretty new web developer.
I am trying to use Gatsby static image component to show an image and then overlay that image with a div element to write over the picture. I am using a styled component to with position absolute, however, that div isn't going over my picture but instead going to my foooter component.
Down the line, once I get the basic layout of my page done, then I will transfer the images to my sanity cms to host the images and query the images with graphql.
This is what I have so far:
import React from "react"
import styled from "styled-components"
import { StaticImage } from "gatsby-plugin-image";
const StyledHome = styled.div`
display: flex;
gap: 2rem;
position: absolute;
flex-direction: row;
margin: 2rem 0;
`;
const HomeTextContainer = styled.div`
position: absolute;
z-index: 5;
left: 50%;
bottom: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
width: 100%;
height: 50%;
`;
export default function IndexPage() {
return (
<>
<StaticImage
src="../images/picturesWeb.png"
alt="Website Example"
placeholder="traceSVG"
layout="fullWidth"
/>
<StyledHome>
<h2>Hello</h2>
</StyledHome>
</>
)
}