我正在尝试创建一行3张图片,文本在底部。我让图片彼此并排排列,但我无法均匀地将它们隔开。图片之间没有任何空间,并且图片没有居中到页面中间。图片更偏向左侧。我该如何解决这个问题?谢谢
/*------------------------Outdooor-----------------------------*/
.outdoor{
padding: 50px;
display:flex;
}
.Kayaking{
width: 450px;
text-align: center;
}
.Hiking{
width: 450px;
text-align: center;
}
.museums{
width: 450px;
text-align: center;
}
#kayak{
height: 350px;
width: 500px;
}
#hiking{
height: 350px;
width: 500px;
}
#museums{
height: 350px;
width: 500px;
}
<section class="outdoor">
<div class="Kayaking">
<img id="kayak" src="Images/Kayaking_Elliott_Bay_in_Seattle.jpg">
<h1>Kayaking at Elliot Bay</h1>
<p>Enjoy a wonder time kayaking at Elliot Bay. Best time to go
right before sunset to see the sun go down behind the Mountians.
</p>
</div>
<div class="Hiking">
<img id="hiking" src="Images/RattlesnakeLedge_KatieEgresi_032321-scaled.jpg">
<h1>Hiking at Rattlesnake Ledge</h1>
<p>A hike at Rattlesnake Ledge is a must. Just 45 minutes West of
Seattle, it's not too far to get away from the city and remain close.
</p>
</div>
<div class="museums">
<img id="museums" src="Images/Museum-of-Pop-Culture_2018_BuildingExterior.webp">
<h1>Seattle Museum of Pop Culture</h1>
<p>Explore modern pop Culture! Excellent location for family and kids.
Located just one block away from the space needle
</p>
</div>
</section>
3条答案
按热度按时间toiithl61#
你应该试试这个,
这是更新的
outdoor
类CSS
这是完整的输出,
x一个一个一个一个x一个一个二个x
aiqt4smr2#
更改你的css代码到这:
mjqavswn3#
你可以使用100%宽度代替手动宽度。px宽度是元素的永久大小。你可以使用百分比宽度,所以它工作正常
您可以使用媒体查询根据屏幕调整列