How to troubleshoot firefox flex display

Asked

Viewed 72 times

1

Created this portfolio it works perfectly in Chrome, but in firefox the tag button that is superimposed on the tag img (to make the shadow effect and open a modal) appears as a fifth item, generating horizontal scroll and not making the shading effect when the mouse passes over, I would like to know how to leave overlapped in firefox!

How it looks on Chrome:(How it should look) inserir a descrição da imagem aqui How it looks in firefox: inserir a descrição da imagem aqui

<style type="text/css">

    .portfolio{margin-bottom: 100px; margin-top: 86px;display: flex; flex-wrap: wrap;}

    .projetos{width: 25%;}

    .projetos-content{position: relative;}

    .projetos-img{width: 100%;}

    .sombra{background: rgba(255,255,255,0.0); width: 100%; height: 100%; position: absolute; top: 0; transition: 0.5s; border: none;}

    .sombra:hover{background: rgba(0, 0, 0, 0.4); cursor: pointer;}

</style>

<div class="portfolio">

  <div class="projetos">

    <div class="projetos-content">

      <img src="1.jpg" class="projetos-img">

      <button type="button" class="sombra" data-toggle="modal" data-target="#exampleModal"></button>

    </div>

  </div>

  <div class="projetos">

    <div class="projetos-content">

      <img src="2.jpg" class="projetos-img">

      <button type="button" class="sombra" data-toggle="modal" data-target="#exampleModal"></button>

    </div>

  </div>

  <div class="projetos">

    <div class="projetos-content">

      <img src="3.jpg" class="projetos-img">

      <button type="button" class="sombra" data-toggle="modal" data-target="#exampleModal"></button>

    </div>

  </div>

  <div class="projetos">

    <div class="projetos-content">

      <img src="1.jpg" class="projetos-img">

      <button type="button" class="sombra" data-toggle="modal" data-target="#exampleModal"></button>

    </div>

  </div> 

</div>

  • Some CSS elements need prefixes to work in different browsers, I’m not sure if it’s the solution but it’s worth taking a look at this Tableless link that talks about Prefixes (https://tableless.com.br/prefixos-dos-browsers-a-web-precis-de-voce/) and this Mozilla Link that talks about Flexbox (https://developer.mozilla.org/en-US/docs/CSS/Usando_caixas_flexiveis_css). In addition, this site automatically applies some prefixes to the code you enter (https://autoprefixer.github.io/)

  • thank you so much I will read and try to apply

1 answer

2


Friend basically what was missing in your code was to define a reference on the axis X, notice that you declared a top as 0, which would be pebble Y, but did not state anything for the axis X, you can use either a left: 0; how I used or right: 0; that also goes well. Then in class .sombra I added a tb left: 0;.

inserir a descrição da imagem aqui

Here’s what it looks like. You can try it on Fire Fox and it’ll work. This particularity goes from browser to browser, there is not much to explain in this "error", this has more to do with the browser rendering engine, which in Firefox is different from Chrome....

.portfolio{margin-bottom: 100px; margin-top: 86px;display: flex; flex-wrap: wrap;}

.projetos{width: 25%;}

.projetos-content{position: relative;}

.projetos-img{width: 100%;}

.sombra{background: rgba(255,255,255,0.0); width: 100%; height: 100%; position: absolute; top: 0; left: 0; transition: 0.5s; border: none;}

.sombra:hover{background: rgba(0, 0, 0, 0.4); cursor: pointer;}
<div class="portfolio">

  <div class="projetos">

    <div class="projetos-content">

      <img  class="projetos-img" src="https://placecage.com/100/100">

      <button type="button" class="sombra" data-toggle="modal" data-target="#exampleModal"></button>

    </div>

  </div>

  <div class="projetos">

    <div class="projetos-content">

        <img  class="projetos-img" src="https://placecage.com/100/100">

      <button type="button" class="sombra" data-toggle="modal" data-target="#exampleModal"></button>

    </div>

  </div>

  <div class="projetos">

    <div class="projetos-content">

        <img  class="projetos-img" src="https://placecage.com/100/100">

      <button type="button" class="sombra" data-toggle="modal" data-target="#exampleModal"></button>

    </div>

  </div>

  <div class="projetos">

    <div class="projetos-content">

      <img  class="projetos-img" src="https://placecage.com/100/100">

      <button type="button" class="sombra" data-toggle="modal" data-target="#exampleModal"></button>

    </div>

  </div> 

</div>

  • Thank you very much, solved the problem!

  • @Demarchi if you do not define where the element should start on one of the axes, the browser does not understand where the element starts and where it ends. But nice that solved! Consider marking the answer as accepted in this icon below the arrows of my answer. So the site does not get the question without accepted answer, even if it has already been solved. Then if another answer comes along that suits you better you can change your acceptance to her.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.