Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is my hero image not showing in the title like it should?

I am trying to get an image to show up behind my title "Strike A Chord" The image is under the hero image section. What am I missing?

Below is first my index.html file, and then the second is my styles.css file.

It was showing up before but after I added some more code it no longer will show and it is just blank behind my title.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

also, if it looks funny and basic, I am a student following the book’s instructions. I haven’t learned the easy shortcuts yet.

EDIT: After removing [class="tab-desk"] from the div id of the hero image, the image shows back up but in the correct spot.

/* CSS Reset */
body,
header,
nav,
main,
footer,
img,
h1,
ul {
  margin: 0;
  padding: 0;
  border: 0;
}

/* Style Rule for Images */
img {
  max-width: 100%;
  display: block;
}

/* style rule for mobile view port */

/*hide tab-desk class */
.tab-desk {
  display: none;
}
/* set rules for header content */
header {
  text-align: center;
  font-size: 1.5em;
  color: #373684;
}

header h1 {
  font-family: "DM Serif Display", serif;
  font-size: 1.5em;
  padding: 4%;
  margin-right: 15%;
}

/* Style rules for navigation area */
nav {
  background-color: #373684;
}
nav ul {
  list-style-type: none;
  text-align: center;
}
nav li {
  display: block;
  border-top: 1px solid #e5e9fc;
  font-size: 1.25em;
}
nav li a {
  display: block;
  color: #fff;
  text-align: center;
  padding: 0.5em 1em;
  text-decoration: none;
}

/* Styles Rule for main content */
main {
  padding: 2%;
  background-color: #e5e9fc;
  overflow: auto;
  font-family: Verdana, Arial, sans-serif;
}
main p {
  font-size: 1.25em;
}
.action {
  font-size: 1.75em;
  color: #373684;
  font-weight: bold;
}
#piano,
#guitar,
#violin {
  margin: 0 2%;
}
#info {
  clear: left;
  background-color: #c0caf7;
  padding: 1% 2%;
}
#info ul {
  margin-left: 10%;
}
.round {
  border-radius: 8px;
}
#contact {
  text-align: center;
}
.tel-link {
  background-color: #373684;
  padding: 2%;
  margin: 0 auto;
  width: 80%;
  text-align: center;
  border-radius: 5px;
}

.tel-link a {
  color: #fff;
  text-decoration: none;
  font-size: 1.5em;
  display: block;
}

#contact .email-link {
  color: #4645a8;
  text-decoration: none;
  font-weight: bold;
}
.map {
  border: 5px solid #373684;
  width: 95%;
  height: 50%;
}

/* Style rules for footer content */
footer {
  text-align: center;
  font-size: 0.65em;
  clear: left;
}
footer a {
  color: #4645a8;
  text-decoration: none;
}
<!--Hero Image-->
<div id="hero" class="tab-desk">
  <img src="images/music-notes.png" alt="colorful music notes" />
</div>

>Solution :

In your CSS code you have the following property:

.tab-desk {
    display: none;
}

This is what is causing your .tab-desk (hero image) to not load. To fix your issue, you can either remove the aforementioned 3 CSS lines or remove the class="tab-desk" from:

<div id="hero" class="tab-desk">
    <img src="images/music-notes.png" alt="colorful music notes" />
</div>

Whichever one suits you best.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading