align images side by side in html

前端 未结 7 1231
太阳男子
太阳男子 2020-12-05 19:40

I want 3 images side by side with caption, at the moment I have 3 images going from top to bottom, with the caption on the left, not on the centre. How do I make the images

相关标签:
7条回答
  • 2020-12-05 20:23

    Try this.

    CSS

    .imageContainer {
        float: left;
    }
    
    p {
        text-align: center;
    }
    

    HTML

    <div class="image123">
        <div class="imageContainer">
            <img src="/images/tv.gif" height="200" width="200" />
            <p>This is image 1</p>
        </div>
        <div class="imageContainer">
            <img class="middle-img" src="/images/tv.gif"/ height="200" width="200" />
            <p>This is image 2</p>
        </div>
        <div class="imageContainer">    
            <img src="/images/tv.gif"/ height="200" width="200"/>
            <p>This is image 3</p>
        </div>
    </div>
    
    0 讨论(0)
提交回复
热议问题