I am facing an issue with the layout of my form. It is structured in three columns: the first column for labels, the second column for inputs, and the third column for units (such as cm or kg). All components are placed inside a table within the form. However, the first column is occupying more horizontal space than necessary even though it has no padding, margin, or border. Below is the code snippet:
body {
font-family: 'Source Sans Pro', sans-serif;
font-size: 14px;
color: #222222;
}
table {
width: 100%;
white-space: nowrap;
}
input {
background-color: #DACBDF;
padding: 8px 10px 8px 10px;
width: 91.5%;
font-family: Georgia;
font-size: 13px;
border: 1px solid #EEEEEE;
}
I have attempted to address this issue by setting td {width: auto}
, but it does not seem to resolve the problem. Any insights on why this might be happening?
UPDATE: Upon further examination, I realize that my question may lack clarity. My ultimate goal is for the width of the td
tags to adjust dynamically based on the content inside them. Can anyone provide guidance on achieving this functionality?