我正在参加 Codewell 挑战,但我陷入了这部分。我无法在它们之间留出均匀的空间,并且图像重叠。
.website {
display: flex;
justify-content: space-between;
}
.arrow {
display: inline-block;
width: 1rem;
}
<div class="website">
<div class="spense">
<img id="spense" src="./Assets/Spense.png" alt="spense">
<h3>Spense.com<img class="arrow" src="./Assets/noun-arrow-2841221-svg.png" alt="arrow-icon"></h3>
Rethinking the way writers get paid, an open resource platform <br> design to help writers focus more on writing, and less on <br> when and how they'll get paid, Projects in collaboration with <br> Codewell.cc
</div>
<div class="yelp">
<img id="yelp" src="./Assets/YelpCamp.png" alt="YelpCamp">
<h3>YelpCamp.com<img class="arrow" src="./Assets/noun-arrow-2841221-svg.png" alt="arrow-icon"></h3>
Allowing backpack travelers to perfectly plan their trip <br> through an open-source platform similar to TripAdvisor. With <br>over 1m MAU, YelpCamp has been the crowd's favorite in <br>2021.
</div>
</div>
最佳答案
您可以在 Flex 容器内的每个子项上使用宽度属性。
.website {
display: flex;
justify-content: space-between;
}
.spense, .yelp{
width:40%;
}
.arrow {
display: inline-block;
width: 1rem;
}
.image{
width:100%;
object-fit:cover;
}
<div class="website">
<div class="spense">
<img class="image" id="spense" src="https://via.placeholder.com/350
C/O https://placeholder.com/" alt="spense">
<h3>Spense.com<img class="arrow" src="./Assets/noun-arrow-2841221-svg.png" alt="arrow-icon"></h3>
Rethinking the way writers get paid, an open resource platform <br> design to help writers focus more on writing, and less on <br> when and how they'll get paid, Projects in collaboration with <br> Codewell.cc
</div>
<div class="yelp">
<img class="image" id="yelp" src="https://via.placeholder.com/350
C/O https://placeholder.com/" alt="YelpCamp">
<h3>YelpCamp.com<img class="arrow" src="./Assets/noun-arrow-2841221-svg.png" alt="arrow-icon"></h3>
Allowing backpack travelers to perfectly plan their trip <br> through an open-source platform similar to TripAdvisor. With <br>over 1m MAU, YelpCamp has been the crowd's favorite in <br>2021.
</div>
关于html - 如图所示,创建两个响应式 DIV,它们之间留有空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71045875/