HTML CSS examples for CSS Form:input button layout
Set width based on buttons width
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #container {<!--from w ww . j a va 2 s . co m--> display: inline-block; overflow: hidden; border: 1px solid red; } #label { position: relative; width: 100%; height: 1.5em; overflow: hidden; white-space: nowrap; } #label span { position: absolute; } </style> </head> <body> <div id="container"> <div id="label"> <span>this is a test thsi is a teat</span> </div> <table> <tbody> <tr> <td> <button>leftttttttttttttttt</button> </td> <td> <button>right</button> </td> </tr> </tbody> </table> </div> </body> </html>