首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >引导调整图像相对于屏幕大小的大小

引导调整图像相对于屏幕大小的大小
EN

Stack Overflow用户
提问于 2020-09-12 05:43:21
回答 1查看 1.5K关注 0票数 1

我有一个任务,我需要做一个网站使用html,css和引导。我几乎完成了网页,但我被困在调整大小的lightbox照片画廊。我想要它根据屏幕大小调整大小。小屏幕=较小的图像。我尝试将图像的最大高度和最大宽度设置为100%,但没有工作。

100%:

200%:

300%:

网址:http://syphym.infinityfreeapp.com/TheOfficialPodcast.html

我希望它不是4比2和2比1,我想调整它的大小,保持它原来的位置。

对不起,我真的不知道怎么解决这个问题

代码:

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">

    <title>The Official Podcast</title>

    <style>
    *
    {
        margin: 0;
        padding: 0;
    }

    #HomeScreen
    {
        background-image: url('Picture/Background.jpg');
        background-size: cover;
        background-position: center;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-content: center;
        padding: 0 20px;
    }
    .Theboys
    {
        background-color: black

    }
    .Title
    {
        text-align-last: center; 
        text-decoration: none;
        color: #f2f2f2;
        font-size: 50px;
        font-family: sans-serif;
        letter-spacing: 0.5px;

    }
    .name
    {
        background-color: black;
        text-align-last: center; 
        text-decoration: none;
        color: #f2f2f2;
        font-size: 30px;
        font-family: sans-serif;
        letter-spacing: 0.5px;
    }
    .gap100
    {
        padding:70px 0px;
    }
    .resize img
    {
        max-height: 100%;
        max-width: 100%;
    }
    
        
</style>
</head>
<body>
    <header id="HomeScreen">
    <section class="Theboys">
    <div class="container">
        <a href=#Official-Podacast>
        <center>
            <img src="https://i.ytimg.com/vi/jFqL8N3t97Y/maxresdefault.jpg" width="80%" height="80%" >
        </center>
        </a>
        <div class="Title">
                The Official Boys
        </div>
        <div class="row">
            <div class="col-md-6 col-lg-3">
                <div class="card border-0">
                    <a class="lightbox" href="#Jackson">
                        <div class="resize">
                        <img src="Picture/Jackson.png" alt="img1" class="card-img-top">
                        </div>
                    </a>
                <div class="name">
                Jackson
                </div>
                    
                </div>
            </div>
            <div class="col-md-6 col-lg-3">
                <div class="card border-0">
                    <a class="lightbox" href="#Andrew">
                        <div class="resize">
                        <img src="Picture/Andrew.png" alt="img1" class="card-img-top">
                        </div>
                    </a>
                <div class="name">

                        Andrew 
                </div>
                </div>
            </div class="name">
            <div class="col-md-6 col-lg-3">
                <div class="card border-0">
                    <a class="lightbox" href="#Charlie">
                        <div class="resize">
                        <img src="Picture/Charile.png" alt="img1" class="card-img-top">
                        </div>
                    </a>
                <div class="name">
                        Charlie 
                </div>
                </div>
            </div>
            <div class="col-md-6 col-lg-3">
                <div class="card border-0">
                    <a class="lightbox" href="#Kaya">
                        <div class="resize">
                        <img src="Picture/Kaya.png" alt="img1" class="card-img-top">
                        </div>
                    </a>
                <div class="name">
                    Kaya 
                </div>
                    
                </div>
            </div>
        </div>
    </div>
    </section>
    </header>
    <section>
    <div class="container">
        <div class = "row gap100">
            <a name="Official-Podacast">
            <div class="col-md-6">
            <h2>The Official Podcast</h2>
            <p>The Official Podcast is where four international man friends congregate to discuss just about everything. Featuring dumb questions, YouTube celebrities, childish giggling, burger puns, more dumb questions, fatherly advice, bad dating stories, even more dumb questions, and a slew of guest stars, The Official Podcast is a weekly show with a little something for everyone. Jackson, Andrew, Charlie, and Kaya gather to talk about only the most important things in life every Thursday at 8pm EST.</p>
            <p>Listen to The Official Podcast:</p>
            <ul>
                <a href="https://podcasts.apple.com/us/podcast/the-official-podcast/id1186089636"><img src="Picture/Itunes.png" width="100" height="100"></a>
                <a href="https://open.spotify.com/show/6TXzjtMTEopiGjIsCfvv6W"><img src="Picture/Spotify.png" width="100" height="100"></a>
                <a href="https://www.youtube.com/playlist?list=PLRD7N-Zrj2DMPlFktUo5BRduSyCxu8nZy"><img src="Picture/Youtube.png"width="100" height="100"></a>
            </ul>
            
            </div>
            <div class="col-md-6">
                <img src="Picture/TheBoys.jpg" class="img-fluid">
            </div>
            </a>
        </div>

        <div class = "row  gap100">
            <div class="col-md-6">
            <a name="Jackson">
            <img src="Picture/Jackson.jpg" class="img-fluid">
            </div>
            <div class="col-md-6">
            <h2>Jackson Clarke</h2>
            <p>Jackson Clarke is from australia he is the co-host of the Official podcast and he swears that he does not eat crayons anymore.</p>
            <p>His internet name is Zealot he manges the editing of the podcast and the moist meter of charlie. He likes lego and dinasours and he is proud of it.</p>
            <p>Watch his content:</p>
            <ul>
                <a href="https://twitter.com/zealotonpc?lang=en"><img src="Picture/Twitter.png" width="100" height="100"></a>
                <a href="https://www.twitch.tv/zealotonpc"><img src="Picture/Twitch.png" width="80" height="80"></a>
                <a href="https://www.youtube.com/channel/UCIq-p3q6B7BFG4SqltI4-7A"><img src="Picture/Youtube.png"width="100" height="100"></a>
                
            </ul>
            </div>
            </a>
        </div>

        <div class = "row  gap100">
            <div class="col-md-6">
            <a name="Andrew">
            <h2>Andrew Wagenheim</h2>
            <p>TAndrew’s notability on the internet comes twofold. He was originally known for his YouTube channel HuggbeesTV, a variety comedy channel, on which he continues to upload. </p>
            <p>Several years later, he also began hosting The Official Podcast alongside Kaya Orsan, Jackson Clarke and Charlie White (known on YouTube as Cr1TiKaL). </p>
            <p>Watch his content:</p>
            <ul>
                <a href="https://twitter.com/HuggbeesTV"><img src="Picture/Twitter.png" width="100" height="100"></a>
                <a href="https://www.twitch.tv/huggbeestv"><img src="Picture/Twitch.png" width="80" height="80"></a>
                <a href="https://www.youtube.com/results?search_query=huggbees"><img src="Picture/Youtube.png"width="100" height="100"></a>
            </ul>
            </a>
            </div>
            <div class="col-md-6">
                <img src="Picture/Andrew Hugbess.png" class="img-fluid">
            </div>
        </div>

        <div class = "row  gap100">
            <div class="col-md-6">
            <a name="Charlie">
            <img src="Picture/Charlie.jpg" class="img-fluid">
            </div>
            <div class="col-md-6">
            <h2>Charlie White</h2>
            <p>Also known as Cr1TiKaL, he is a supremely popular gaming commentator who would earn an astounding 5 million subscribers with viral videos such as "The Most Difficult Game Ever Created Gameplay and Commentary," "The Real Mighty Thirsty" and "The Real Edge of Glory."</p>
            <p>He also works on a side project called moist meter where he rate different games and movies.</p>
            <p>Watch his content:</p>
            <ul>
                <a href="https://twitter.com/MoistCr1TiKaL?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor"><img src="Picture/Twitter.png" width="100" height="100"></a>
                <a href="https://www.twitch.tv/moistcr1tikal"><img src="Picture/Twitch.png" width="80" height="80"></a>
                <a href="https://www.youtube.com/user/penguinz0"><img src="Picture/Youtube.png"width="100" height="100"></a>
            </ul>
            </div>
            </a>
        </div>
        <div class = "row  gap100">
            <div class="col-md-6">
            <a name="Kaya">
            <h2>Kaya Orsan</h2>
            <p>He was born in Germany, but his family is from Turkey, where he spent half of his life and a half in Germany. For a while, he was in Turkey but he's back in Germany.</p>
            <p>Kaya is known for drinking and going on rants about things that pisses him off. You can buy a poster with his special couger poster on it off the Official Podcast Patreon for $50,000.</p>
            <p>Watch his content:</p>
            <ul>
                <a href="https://twitter.com/kayaorsan"><img src="Picture/Twitter.png" width="100" height="100"></a>
                <a href="https://www.twitch.tv/kayaorsan"><img src="Picture/Twitch.png" width="80" height="80"></a>
                <a href="https://www.youtube.com/channel/UC5sRNZKwC-CW7cwT-im4RgQ"><img src="Picture/Youtube.png"width="100" height="100"></a>
            </ul>
            
            </div>
            </a>
            <div class="col-md-6">
                <img src="Picture/KayaOrsan.jpg" class="img-fluid">
            </div>
        </div>

    </div>
</section>











    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
</body>
</html>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-09-12 06:17:32

当您与col一起使用引导时,您应该知道页面宽度被划分为12。例如,如果您有4个divs,并且每个div都有col-3,那么它们将放在同一行中。

但是,如果您试图将4次col-6放在同一行中,这将是一个错误(正如您使用col-md-6时所做的那样)。

对于您的要求,我建议将类更改为col-3,而不是4div的每个divcol-md-6 col-lg-3

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63857235

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档