前提・実現したいこと
画像のようなアカウント名・ユーザーID・投稿時間の3つを横に並列し、アカウント名やユーザーIDが右端まで到達するほど長くなった場合はまずユーザーIDの一部を3点リーダーで非表示、それ以上長くなった場合はアカウント名を3点リーダーで非表示にする処理を作りたいです。投稿時間は3点リーダーを適用せず常に表示したいです。
該当のソースコード
html
1<div class="user_profile"> 2<a href="{{ route('users.show', $topComment->user) }}" 3class="_ellipsised"> 4<span class="name">{{ $topComment->user->name }}</span> 5<span class="screen_name">@screen_name</span> 6</a> 7<span class="date">{{ $comment->updated_at->diffForHumans() }}</span> 8</div>
css
1.user_profile { 2 display: flex; 3 margin-left: 50px; 4} 5 6.user_profile a { 7 -webkit-line-clamp: 1; 8} 9 10.user_profile .name { 11 display: inline-block; 12 margin-right: 4px; 13 max-width: 440px; 14 font-weight: bold; 15} 16 17.user_profile .screen_name { 18 vertical-align: text-bottom; 19 margin-right: 8px; 20} 21 22.user_profile .date { 23 display: inline-block; 24 color: #999; 25}
回答2件
あなたの回答
tips
プレビュー

2022/02/14 12:03