gpt4 book ai didi

html - 需要帮助创建一个充满图像的响应式页脚

转载 作者:行者123 更新时间:2023-11-28 16:49:13 26 4
gpt4 key购买 nike

我正在尝试制作一个充满图像的页脚,但找不到使它在 PC 和媒体设备上看起来更漂亮的方法。

我希望铜牌赞助小猫向左移动,支持小猫向右移动,同时保持页脚的合理高度。

我已经尝试过网格系统,但无法让青铜赞助商小猫的照片保持在合理的大小,或者照片超出容器并且页脚变得比我的整个网页都大。而且我以前从未使用过 flexbox。

footer .container {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.bronze-container {
max-width: 300px;
}
.sponsor-container {
}
.othersupporter {
background: white;
flex: 1;
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
}
.othersupporter > p {
background: white;
color: black;
padding: 1%;
margin: 1px;
flex: 1 0 15%;
}
.row h4 {
padding-left: 2rem;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

<title>Title of the document</title>
</head>

<body>
<footer style='background-color:white; width:100%; height:250px'>
<div class='container' style='max-width:1024px; height:250px'>
<div class='bronze-container'>
<div class='row text-center' >
<h4 >Bronze Sponsor </h4>
</div>
<div class='row text-center'>
<img src="https://i.imgur.com/ZA7mKts.png" class="card-img" alt="...">
</div>
</div>
<br class="visible-m"/>
<div class='sponsor-container'>
<div class="row text-center" >
<h4>Supporters</h4>
</div>
<div class="othersupporter">
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
</div>
</div>
</div>
</footer>
</body>

</html>

最佳答案

您在 footer .container 上的 flex-wrap 声明导致它们垂直堆叠而不是并排放置。我在 .bronze-container 上关闭了 max-width 并将其替换为将基础设置为 200px 的 flex 声明,我觉得在这里的预览中看起来很合理。您可能需要针对您的实现进行调整。

footer .container {
display: flex;
justify-content: space-between;
}

.bronze-container {
flex: 0 0 200px;
}

.sponsor-container {}

.othersupporter {
flex: 1;
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
}

.othersupporter > p {
padding: 1%;
margin: 0;
flex: 1 0 15%;
}

.row h4 {
padding-left: 2rem;
}
<!DOCTYPE html>
<html>

<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

<title>Title of the document</title>
</head>

<body>
<footer>
<div class='container'>
<div class='bronze-container'>
<div class='row text-center'>
<h4>Bronze Sponsor </h4>
</div>
<div class='row text-center'>
<img src="https://i.imgur.com/ZA7mKts.png" class="card-img" alt="...">
</div>
</div>
<br class="visible-m" />
<div class='sponsor-container'>
<div class="row text-center">
<h4>Supporters</h4>
</div>
<div class="othersupporter">
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
<p><img src="https://i.imgur.com/ZA7mKts.png" class="card-img " alt="..."></p>
</div>
</div>
</div>
</footer>
</body>

</html>

关于html - 需要帮助创建一个充满图像的响应式页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59649294/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com