简体   繁体   English

浏览器缩小时如何让图片和文字一起缩小?

[英]How I can let the pictures and texts shrink together when I narrow the size of the browser?

I am making a user profile page for our group app, I want to know that how I can make the size of the picture and the size of the text shrink when I shrink the size of the browser.我正在为我们的群组应用程序制作用户个人资料页面,我想知道如何在缩小浏览器大小时缩小图片大小和文本大小。

below are the scss code for classes:下面是类的 scss 代码:

    .show-picture{
        width: 200px;
        height: 150px;
        border-radius: 10%;
        size-adjust:relative;
    }

    .Trip_info{
        width: 20%;
        height: 200px;
        float:left;
    }

    .Planner_page{
        width: 20%;
        height: 200px;
        margin-left:40%;

    }

    .Social{
        width: 20%;
        height: 200px;
        float: left;
    }

    .Setting{
        width: 20%;
        height: 200px;
        margin-left:40%;
    }


    .button{
        font-size: 2em;
        letter-spacing: 0px;
        margin-bottom: 30px;
        margin: 4px 2px;
        cursor: pointer;
        text-align: center;
        text-decoration: none;
        color: grey;
  
    }


I tried to divided them into div of rows but the size will not shrink.我试图将它们分成行的 div,但大小不会缩小。 And also I tried the width and height auto but that size will be very werid.我还尝试了自动宽度和高度,但那个尺寸会很奇怪。

 body{ margin: 0; padding: 0; background-color: grey; text-align: center; } p{ color: blue; font-size: 40px; } img{ width: 300px; height: 300px; } /* media query breakpoints */ @media screen and (max-width: 480px){ body{ background-color: lightblue; } p{ color: red; font-size: 20px; } img{ width: 150px; height: 150px; } }
 <p>Dummy Text</p> <img src="http://docllpdemo.com/asteroid/wp-content/uploads/2020/11/dummy-man.png" alt="dummy-man">

use media query breakpoints for a responsive website为响应式网站使用媒体查询断点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM