Place an image at the top of a DIV and center it

前端 未结 6 1449
再見小時候
再見小時候 2021-01-24 08:53

I have 2 containers, one grey, one white. I\'d like to place an image (this will be a triangle down) to the very top of the white background and center it horizontally. How coul

6条回答
  •  無奈伤痛
    2021-01-24 09:33

    Update your .triangle class to this. You need to make it display as block. And add bottom margin to add space between title and the image.

    .triangle {
        margin: auto;
        margin-top: -76px;
        display: block;
        margin-bottom: 30px;
    }
    

提交回复
热议问题