JSFiddle - React, Tailwind, and code Playground

by Alessandro Vernet

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Equal Width Buttons</title>
    <style>
        .button-container {
            display: inline-flex;
        }

        .button-container button {
            flex: 1;
            white-space: nowrap;
        }

        /* Ensure both buttons have the same width based on the longest text */
        .button-container button {
            width: 100%;
        }
    </style>
</head>
<body>

<div class="button-container">
    <button>Short</button>
    <button>Longer Text</button>
</div>

</body>
</html>