Originally I needed this for a chat app. Now I need it for something else as well... I figure I\'d better ask.
Elaborating the chat app example: chat messages are
You are almost good with your grid solution. You can keep the li
element by introducing display:contents
(https://caniuse.com/#feat=css-display-contents) but you will still not be able to style the li
since this one will no more generate a box content:
ul {
display: grid;
grid-template-columns: repeat(2, auto);
}
li {
display:contents;
}
.author {
font-weight: bold;
margin-right: 5px;
text-align: right;
}
.author:after {
content: ":";
}
span {
margin-top: 10px;
}
Another way is to consider display:table
like below:
ul {
display: table;
}
li {
display: table-row;
}
.author {
font-weight: bold;
padding-right: 5px;
text-align: right;
}
.author:after {
content: ":";
}
span {
padding-top: 10px;
display: table-cell;
}