As a beginner in programming, I've taken on a project to enhance my skills.
I'm looking to add a div with text overlaying an image, similar to the example shown below:
https://i.sstatic.net/AnfM2.png
The goal is to have half of the div display an image and the other half show text. Can you guide me on how to achieve this?
Below is the code I've implemented in codesandbox
import React from "react";
import "./styles.css";
export default function App() {
return (
<div className="App">
<h1>Restaurant</h1>
<div
style={{
display: "flex",
flexDirection: "column",
justifyContent: "baseline",
alignItems: "baseline",
height: "200px",
width: "100%",
maxWidth: "300px"
}}
>
<div>
<img
style={{
width: "100%",
height: "100%"
}}
src="https://b.zmtcdn.com/data/collections/271e593eb19475efc39021c6e92603db_1454591396.jpg"
alt=""
className="img"
/>
</div>
<div className="divText">
<span
style={{
color: "#fff",
backgroundColor: "#000"
}}
>
Lorem Ipsum! Lorem Ipsum! Lorem Ipsum!
</span>
</div>
</div>
</div>
);
}
Thank you for your assistance!