1

I am designing a gallery, which shows a list of all the images on the page. Now I am keeping images inside a container such that all the images maintain a specific size on the screen. So the CSS for the same is

.gallery-image{
    border-radius: 2rem !important;
    overflow: hidden;
    position: relative;
    background-color: black;
    width: 100%;
    height: 100%;
    z-index: 99;
  }
  
  .image-box{
    opacity: 0.6 !important;
    height: 150px;
    width: 100%;
    object-fit: cover;
    overflow: hidden;
    transition:all 0.3s ease-in-out !important;
  }
  .image-box:hover{
    opacity: 1 !important;
    transform: scale(1.2);
    overflow: hidden;
  }


 
 <div class="col-md-2 col-sm-4 col-4 my-2 align-self-center">
          <div class='gallery-image'>
               <img src={baseUrl + image.path} class="image-box" />
          </div>
 </div>

gallery-image is my image container and the image-box is the style for my CSS. Where can I add a property such that my image container looks 1:1 (perfect square) in all the screens?

Here I am attaching images for the reference

ViewPort on Lappy

t

Viewport on Mobile

enter image description here

Paulie_D
  • 102,164
  • 10
  • 117
  • 144
classydraught
  • 465
  • 4
  • 12

0 Answers0