Why can't I target my footer image with CSS

Issue

.footer_image {
  height: 60rem;
}
<footer>
  <div class="footer_image">
    <img src="https://via.placeholder.com/200x200" style="margin-left:20px">
  </div>
</footer>

I cant seem to target the properties to change my image in my footer, what am I doing wrong?

Solution

You can use

.footer_image img {
}

This will work on all pictures which have the html img tag and are inside the .footer_image class

Or you can assign a class or id to your image to define its properties

<img class="mysuperfancyimage" src="logo_footer.png" style="margin-left:20px">
<img id="mysuperfancyimage" src="logo_footer.png" style="margin-left:20px">

You can call classes with a dot and and IDs with a Rhombus

.mysuperfancyimage {
}
#mysuperfancyimage {
}

Answered By – Spyr0

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published