I am trying to figure out why my image won’t add to the WordPress website I am creating. This course came with other images that will display but not the ones I add as a jpg file. I am not sure why it will add the other jpg images but not the ones I want. Here’s my code:
<?php get_header(); ?>
<div class="page-banner">
<div class="page-banner__bg-image" style="background-image: url(<?php echo
get_theme_file_uri('images/traffic.jpg') ?>)"></div>
<div class="page-banner__content container t-center c-white">
<h1 class="headline headline--large">TBS</h1>
<h2 class="headline headline--medium">Working to make traffic safer</h2>
<h3 class="headline headline--small">Explore constructing, utlities, and other types of work we do</h3>
<a href="#" class="btn btn--large btn--blue">Service & Support</a>
<a href="#" class="btn btn--large btn--blue">Signs</a>
<a href="#" class="btn btn--large btn--blue">Utilities</a>
</div>
</div>
I am not sure if I need to add more information to this.
2
Answers
I figured it out. I added the image to my image folder but it wasn't refreshed in VS editor. If you add images to a folder, make sure to refresh the image folder.
Try this:
Problem is that you are closing
<div>
tag without adding any content in that:So I have added height and width for showing the background image. Either you can add some content or specify the height and width of that div.