JSFiddle - React, Tailwind, and code Playground

by Roman

HTML

<table>
  <tr>
    <th>Первая колонка
    <th>Вторая колонка
  </tr><tr>
    <td>Какая-то метка
    <td><div>Есть таблица фиксированной ширины, состоящая из двух колонок. Необходимо с помощью css выставить: ширину левой колонки - по содержимому, ширину правой - остаток (ширина таблицы - ширина первой колонки) и если необходимо обрезать текст. Пробовал</div>
  </tr>
</table>

CSS

table {
  width: 100%;
  line-height: 1.5em;
}

tr > :first-child {
  width: 0;
  white-space: nowrap;
  vertical-align: top;
}

tr > :last-child {
  width: 100%;
  position: relative;
  vertical-align: top;
}

tr > :last-child > div {
  position: absolute;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}