Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
Firefox - Img with height 100% makes parent div take the source img width

First of all, I want to say I've read all the similar questions before opening this one. None of the solutions suggested worked for me.


I have a modal div, with size relative to viewport. Inside it, I have two divs. First div, contains 2 icons (only showing on hover) and an img, all of them wrapped individually in divs.

My purpose is to resize the img responsive, so I can't set a specific height.

On Chrome, everything works as expected. chrome

On Firefox, the image wrapper (yellow outline) is taking the original width of the img. firefox

Here is the code

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, .5);
  color: white;
  transition: transform .3s;
  z-index: 9;
}

.modal-content {
  background-color: #662824;
  color: #f3e5c0;
  border-radius: 8px;
  padding: 1rem;
  height: 60%;
  width: 60%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.modal-carrousel {
  display: flex;
  flex-grow: 1;
  flex-direction: row;
}

.modal-details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 15px;
  padding: 0 1rem;
}

.modal-img {
  height: 100%;
  width: auto;
}

@-moz-document url-prefix() {
  .modal-carrousel {
    outline: yellow 3px solid;
  }
  .modal-img {
    outline: green 5px solid;
  }
}
<div class="modal">
  <div class="modal-content">

    <div class="modal-carrousel">

      <div class="modal-icon-change-container">
        <img class="modal-icon-change" src='/assets/arrow_prev.svg' />
      </div>

      <div class='modal-img-container'>
        <img class='modal-img' src="/assets/img1.jpg" />
      </div>

      <div class="modal-icon-change-container">
        <img class="modal-icon-change" src='/assets/arrow_next.svg' />
      </div>

    </div>

    <div class="modal-details">
      sample text
    </div>

  </div>
</div>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!