我有一个包含三个图像的导航 div。每个图像都有一个绝对位于图片底部的标题元素。我试图在同一行上显示所有三个彼此相邻的图像,但图片显示为块。
HTML:
<div class = "nav">
<div class = "container">
<div class = "image">
<img src = "img1">
</div>
<div class = "title">
<p> text1 </p>
</div>
</div>
<div class = "container">
<div class = "image">
<img src = "img2">
</div>
<div class = "title">
<p> text2 </p>
</div>
</div>
<div class = "container">
<div class = "image">
<img src = "img3">
</div>
<div class = "title">
<p> text3 </p>
</div>
</div>
</div>
CSS:
.nav {
display: inline;
}
.container {
position: relative;
width: 100%;
}
.image img {
width: 30%;
height: 4.5in;
}
.title {
width: 30%;
position: absolute;
bottom: 0; left: 0;
}