How to create Divs with Specific Images?

Asked

Viewed 70 times

-2

inserir a descrição da imagem aqui

What is the best way to create Ivs with the images below using CSS? I would like my dashboard to look exactly like the image you have as an example.

I created two classes to try to insert, but the same gave problem and the image was cut.

.squareGray{
    background-color:#808080;
    color:white; 
    font-size:30px;
    background-image:url("../Images/caixa_cinza.png");
    background-size: cover;

}

.squareGreen{
    background-color:green;
    color:white; 
    font-size:30px;
    background-image:url("../Images/caixa_green.png");
    background-size: no-repeat;

}
<c:if test="${realizadoSG < metaSG}">
    <div class="container">
      <div class="marca">
        SAMSUNG
      </div>
      <div class="meta metaFormat">META:
        <fmt:formatNumber value="${SG.rows[0].META}" type="currency"/>
      </div>
      <div class="rel squareGray">ACUMULADO <br><br>
        <fmt:formatNumber value="${realizadoSG}" type="currency" /><br>
        <h2>
          
          <c:out value="${SG.rows[0].ACUMULADO}" />%</h2>
        </br>
      </div>
    </div>
  </c:if>

1 answer

2


If I understood correctly, I would do it this way:

Would use 3 Divs, one is the container with the background of the map of Brazil and would use two others internally to add the 2 other images.

<div class="bg">
  <div class="img"></div>
  <div class="img"></div>
</div>

And, I would use CSS grid to work the images' internal Divs. As far as I can see, the Divs are on a right and left margin (and are not centered on any axis)

.bg {
  padding-top: nPx; //valor em px da margem para cima
  padding-right: nPx; //valor em px da margem para a direita

  display: grid;
  grid-template-rows: repeat(2, max-content);
  gap: nPx; //distância entre as duas imgs
  .img {
     background-image:url("...");
     background-size: cover;
  }
}

If this is not what you want, I ask you to rephrase your question a little because I had difficulty understanding what you want to do, where you want to arrive and how is your situation at the moment (how is getting on your screen)

Browser other questions tagged

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