I want an img
on my website but for some reason, I only get a square outline of where the img
should be.
import img from "../assets/img.svg";
export default function Landing() {
return (
<img scr={img} alt={this is a img} className={styles.img} />
);
}
Styles:
.img {
width: 10em;
height: 10em;
object-fit: cover;
z-index: 1000000;
}
I gave it a really big z-index
so it would be on top but still, it doesn’t work. Also when I use another image like a png, it doesn’t work. This is what I get. My console doesnt give any warning or error just like my terminal in vs code
Do you guys know how to fix it??
2
Answers
I assume you are using the React Framework. Then I would
advise to use the imported image as a Component itself.
That should work. But name it something different, "img" is also
a jsx tag. I would do the following
Spelling mistake of src is there in img tag