JSFiddle - React, Tailwind, and code Playground

by mori57

HTML

<div class="container">
    <label for="hundredpct">Name:</label>
    <input id="hundredpct" value="This should be 100% but not exceed the container.">
</div>

CSS

.container {
    border: 1px solid black;
    padding: 8px;
    font-family: Arial;
    margin: 16px;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-flex;
    display: flex;
}

.label {
    width: 90px;
    flex: 1;}

.content {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;    
    min-width: 0;
    width: 100%;}

input {
    width: 100%;
    border: 1px solid black; 
    border-radius: 4px;
    padding: 4px;
}

.container {
    overflow:hidden;
    width:100%;
    display:table;
}

.container label, .container input {
    display:table-cell;
    width:99%;
    vertical-align:baseline;
}

.container label {
    width:90px;
}