JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container clear">
<button class="btn" type="button">Button 1</button>
</div>
<div class="container clear">
<button class="btn" type="button">Button 1</button>
<button class="btn" type="button">Button 2</button>
</div>
<div class="container clear">
<button class="btn" type="button">Button 1</button>
<button class="btn" type="button">Button 2</button>
<button class="btn" type="button">Button 3</button>
</div>
CSS
* {
box-sizing: border-box;
}
.clear:before,
.clear:after {
content: " ";
display: table;
}
.clear:after {
clear: both;
}
.container {
margin-bottom: 15px;
}
.btn {
display: inline-block;
float: left;
margin: 0;
font-size: 14px;
padding: 15px;
border: 1px solid red;
vertical-align: middle;
}
.container .btn:nth-child(1):nth-last-child(1) {
width: 100%;
}
.container .btn:nth-child(1):nth-last-child(2),
.container .btn:nth-child(2):nth-last-child(1) {
width: 50%;
}
.container .btn:nth-child(1):nth-last-child(3),
.container .btn:nth-child(2),
.container .btn:nth-child(3):nth-last-child(1) {
width: 33.333333%;
}