クラスやラッパー要素を追加せずに、「and commented:」を objectname の後にインラインで (コメントがある場合は明らかに) 表示することは可能ですか? これをできるだけシンプルに保ちたいと思います。コメントにラッパーを追加することでそれを行うことができますが、きれいではありません。
機能しない:
.username, .objectname { font-weight:bold; }
.objectname:before {content: "'"; }
.objectname:after { content: "'"; }
.comment { font-style: italic; display: block; margin: 3px 0px 3px 0px; background-color: pink; }
.comment:before {content: "and commented:"; display:inline; background-color: purple;}
.eventtime { display: block; background-color: yellowgreen;margin: 3px 0px 3px 0px; color: #A1A1A0; }
<div class="item">
<span class="username">Some Person</span>
completed the task
<span class="objectname">A Random Task</span>
<span class="comment">silly comment silly comment silly comment silly comment silly comment silly comment silly</span>
<span class="eventtime">Today @ 12:37PM</span>
</div>
働く:
.username, .objectname { font-weight: bold; }
.objectname:before {content: "'";}
.objectname:after { content: "'"; }
.comment { font-style: italic; display: block;margin: 3px 0px 3px 0px; background-color: pink;color: #919190;}
.commentwrapper:before {content: "and commented:"; display:inline; background-color: purple;}
.eventtime { display: block; background-color: yellowgreen;margin: 3px 0px 3px 0px; color: #A1A1A0; }
<div id="item1" class="item">
<span class="username">Some Person</span>
completed the task
<span class="objectname">A Random Task</span>
<span class="commentwrapper">
<span class="comment">silly comment silly comment silly comment silly comment silly comment silly comment silly comment silly comment silly comment silly comment silly comment silly comment</span>
</span>
<span class="eventtime">Today @ 12:37PM</span>
</div>