如何水平打印我的项目成员头像在laravel刀片文件中?

问题描述 投票:0回答:1

我的Laravel刀片文件中有一些成员头像打印。

@foreach( $project->collaborators as $collaborator)
    <div>
        <span>
            <img src="{{ $collaborator->user()->first()->getAvatarUrl() }}" />
            {{ $collaborator->user()->first()->name}}
        </span>
    </div>
@endforeach

这是在我的刀片文件中垂直打印。但我需要水平打印。我怎样才能做到这一点?

php css html5 laravel-5
1个回答
0
投票

尝试将div显示方法更改为内联,而不是默认块:

 @foreach( $project->collaborators as $collaborator)
     <div class="collaborator">
         <span>
             <img src="{{ $collaborator->user()->first()->getAvatarUrl() }}" />
                             {{ $collaborator->user()->first()->name}}
         </span>
      </div>
 @endforeach

并在CSS中:

.collaborator {
    display: inline;
    /*width: 200px; probably you'll need to set the width*/
}
© www.soinside.com 2019 - 2024. All rights reserved.