调整图库中所有图像的大小以在同一级别(HTML/CSS)上截止

Resize all images in a gallery to cut off at the same level, HTML/CSS

提问人:shotbykamilo 提问时间:7/31/2023 最后编辑:shotbykamilo 更新时间:7/31/2023 访问量:34

问:

我正在我的摄影作品集网站上工作,并将这三张图像放在一个画廊中,它们响应迅速,并且作品集在移动设备上看起来很棒,但是在桌面上,图像的显示方式并不令人赏心悦目,您可以在以下位置查看实时:https://www.shotbykamilo.com/portrait.html 图像在这里显示问题

我尝试过调整一堆东西的大小并观看教程,但是我被困住了,因为我是非常新手的程序员并且在线使用了很多资源。

法典:

/**************** gallery.html ***************/
/* section three */
.section-three{
    margin: 40px 0;
}
.single-img{
    position: relative;
    margin: 10px;
    
}
.single-img-content{
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;

    
}
.single-img-content h3{
    font-size: 18px;
    font-weight: 300;
    text-transform: uppercase;
    
}
/************** end of gallery.html ***********/
/***************** Media Queries *****************/
@media screen and (min-width: 800px){
    /* section three */
    .gallery{
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

@media screen and (min-width: 1200px){
    /* section three */
    .gallery{
        grid-template-columns: repeat(3, 1fr);
    }
}}


/************** end of Media***********/``` 

Main code: 
 <!-- main -->
  
 <section class = "section-three" > <section id = "portfolio"></section>
 <div class = "container">
     <div class = "gallery">
             

            
         <a href = "matrix (1).jpg">
             <div class = "single-img">
                 <img src = "matrix (1).jpg" alt = "gallery image" >
                 <div class = "single-img-content">
                     
                 </div>
             </div>
         </a>

            
         <a href = "matrix (2).jpg">
             <div class = "single-img">
                 <img src = "matrix (2).jpg " alt = "gallery image">
                 <div class = "single-img-content">
                     
                 </div>
             </div>
         </a>

            
         <a href = "matrix.jpg">
             <div class = "single-img">
                 <img src = "matrix.jpg"  alt = "gallery image">
                 <div class = "single-img-content">
                     
                 </div>
             </div>
         </a>


     </div>  
 </section>
 <!-- end of main -->

html css 媒体查询 css-position 图片库

评论

0赞 Dhia 7/31/2023
将代码块包装在“中,您的代码在这里”“,它将起作用

答: 暂无答案