【问题标题】:media queries, image won't move媒体查询,图像不会移动
【发布时间】:2021-04-26 14:12:07
【问题描述】:

this is a screenshot of my website

嗨!我目前正在学习前端开发语言。我想将我的图像移动到 div.kitchen-image 容器所在的位置......但它不会移动。我的查询代码是这样的:

    /*media queries*/
    
    @media only screen and (max-width: 600px) {
        nav{
            display: flex;
            flex-wrap: wrap;      
            line-height: 2;
        }
        .logo {
            margin:0 auto;
        }
        .nav-links ul li a{
            margin-left:15px;
            
        }
        .kitchen-image {
            height:200px;
        }
        .main-pic{
            width:400px;   
        }
    }

尝试改变图像本身的宽度和高度,但仍然没有结果。

【问题讨论】:

    标签: html css flexbox responsive-design


    【解决方案1】:

    您可以使用 CSS 属性 transform: translate() 在 Image 的类中使用这个 CSS

    例如:下面给出的坐标只是一个例子。

    .kitchen-image {
            height:200px;
            transform: translate(50px, 100px);
        }
    

    【讨论】:

      猜你喜欢
      • 2018-06-05
      • 2021-09-23
      • 1970-01-01
      • 2014-09-19
      • 1970-01-01
      • 2018-04-10
      • 2015-09-02
      • 2021-12-09
      • 2011-12-29
      相关资源
      最近更新 更多