JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="container">
<div class="box">
<div class="text-title">
<strong>Short title</strong>
</div>
<div class="text-body">
<div class="text-inner">This is the text description of the item.
It can flow onto more than 2 lines, too,
if there is room for it, but otherwise
should only show 1 line.
</div>
</div>
</div>
<div class="box">
<div class="text-title">
<strong>Long title that will span more than 2 lines when we're done.</strong>
</div>
<div class="text-body">
<div class="text-inner">This is the text description of the item.
It can flow onto more than 2 lines, too,
if there is room for it, but otherwise
should only show 1 line.
</div>
</div>
</div>
</div>
</body>
</html>
CSS
#container {
width: 100px;
}
strong {
font-size: 16px;
display: block;
max-height: 32px;
overflow: hidden;
}
.text-title:after {
content: '...';
position: absolute;
left: 80px;
top: 26px;
width: 12px;
height: 0;
line-height: 0;
}
.box {
font-family: Helvetica;
font-size: 12px;
line-height: 16px;
max-height: 48px;
overflow: hidden;
margin-top: 14px;
border: solid 1px red;
position: relative;
}
.box:after {
content: '...';
position: absolute;
left: 80px;
bottom: 0;
}
.text-body {
position: relative;
}
.text-body:before {
content: '';
position: absolute;
left: 80px;
top: 14px;
width: 12px;
height: 2px;
background: white;
}
.text-inner {
width: 90px;
padding-right: 10px;
}