如何在同一行显示多个图像,并使用 HTML/CSS 将标题放在每个图像下方的中心?
这是我目前拥有的:
HTML:
<div class="iconbox">
<div id="tut-icon"><p><img src="images/tuticon.png" alt="Written Tutorials" />Some text</p></div>
<div id="vid-icon"><p><img src="images/vidicon.png" alt="Video Tutorials" />Some text</p></div>
<div id="add-icon"><p><img src="images/addtuticon.png" alt="Add Tutorials" />Some text</p></div>
</div>
CSS:
.iconbox {
height: 128px;
padding: 20px;
display: inline;
}
#tut-icon, #vid-icon, #add-icon {
text-align: center;
width: 128px;
}
#tut-icon img, #vid-icon img, #add-icon img {
display: inline-block;
}
这是代码的 JSFiddle:http: //jsfiddle.net/swiftsly/24m7L/