简体   繁体   English

如何缩小图像以填充屏幕大小?

[英]How can I shrink images to fill screen size?

I have a website where I have made it so that the 4 pictures will be on the same line like this but on smaller devices one of the pictures goes down a line.我有一个网站,我已使4张图片会像在同一行,但在较小的设备的图像的一个出现故障的线路。 Is their a workaround that makes them all on the same line?他们的解决方法是让他们都在同一条线上吗?

This is the html:这是html:

    <center>
    <h1>Meet Our Officers!</h1>
    <center>
    <div class="main">
        <figure>
            <img src="boysmeettheofficers/Adnan AL-Zoibi.jpg" width="275" height="300" alt="missing">
            <center><figcaption><h2>President</h2></figcaption></center>
        </figure>
        <figure>
            <img src="boysmeettheofficers/Adnan AL-Zoibi.jpg" width="275" height="300" alt="missing">
            <center><figcaption><h2>Vice President</h2></figcaption></center>
        </figure>
        <figure>
            <img src="boysmeettheofficers/Adnan AL-Zoibi.jpg" width="275" height="300" alt="missing">
            <center><figcaption><h2>Secertary</h2></figcaption></center>
        </figure>
        <figure>
            <img src="boysmeettheofficers/Adnan AL-Zoibi.jpg" width="275" height="300" alt="missing">
            <center><figcaption><h2>Treasurer</h2></figcaption></center>
        </figure>
    </div>

column柱子

.main {
    display:flex;
    flex-direction: column;
 }

line线

.main {
    display:flex;
 }

Yes absolutely!是的,一点没错! You should set the width of the figures to width: 25%您应该将数字的宽度设置为width: 25%

So with your extracted html I would do:所以用你提取的 html 我会这样做:

.main {
  display: flex;
}

.main figure {
  width: 25%;
}

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

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