Reputation: 3478
I am trying to load image in html like this
<body>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-4"><img class="img-fluid" src="../static/images/zep.png" /></div>
</div>
<div class="row justify-content-center">
<div class="col-md-12 text-center"><h1>Coming Soon.</h1></div>
<!-- <div class="col-md-12 text-center"><p>Subscribe to our newsletter and stay tuned</p></div> -->
</div>
<!-- <div class="col-md-12 text-center"><button class="btn btn-custom">Subscribe</button></div> -->
</div>
</body>
And this is my folder structure
So when I run it, I get
Failed to load resource: the server responded with a status of zep.png:1 404 ()
What am I doing wrong? Any help would be appreciated. Thanks
Upvotes: 1
Views: 6226
Reputation: 116051
You should not include static
in the img
tag's src
. Resources placed in src/main/resources/static
will be served from the root of your application. This means that src/main/resources/static/images/zep.png
will be served from /images/zep.png
.
Upvotes: 3