Css 引导4对齐div';s在一行中,位于顶部边界处

Css 引导4对齐div';s在一行中,位于顶部边界处,css,twitter-bootstrap,bootstrap-4,Css,Twitter Bootstrap,Bootstrap 4,我想对齐和图像以及一个div内联。我还希望图像和div的顶部也对齐。这就是我目前所拥有的 <div> <img src="http://lorempixel.com/500/333/nature/2" class="img-fluid d-inline-block"> <div class="comment d-inline-block"> <div class="comment-header"> <span>t

我想对齐和图像以及一个div内联。我还希望图像和div的顶部也对齐。这就是我目前所拥有的

<div>
<img src="http://lorempixel.com/500/333/nature/2" class="img-fluid d-inline-block">
<div class="comment d-inline-block">
    <div class="comment-header">
        <span>title</span>
    </div>
    <blockquote>comment</blockquote>
</div>

标题
评论

我尝试了类d-inline-block,它接近于我想要的,但是我需要文本位于顶部


您可以在这里看到:

您需要的只是一个垂直对齐更改:

.comment {
    vertical-align: top;
}

Bootstrap 4包含一个实用程序类:
align top
不需要额外的CSS

<div>
    <img src="http://lorempixel.com/500/333/nature/2" class="img-fluid">
    <div class="comment d-inline-block align-top">
        <div class="comment-header">
            <span>title</span>
        </div>
        <blockquote>comment</blockquote>
    </div>
</div>

标题
评论