[html] Adjust table column width to content size

Form (with firebug highlight hover the td):

example

Label column CSS:

width: auto;
padding: 0;
margin: 0;

The problem:

Why my left columns have that invisible "padding-right"? It's not possible to shrink columns to fit their content?

--EDIT--

The problem was the table itself. I defined table with "width: 100%". Removed that and the problem is gone.

This question is related to html css css-tables

The answer is


maybe problem with margin?

width:auto;
padding: 0px;
margin: 0px

If you want the table to still be 100% then set one of the columns to have a width:100%; That will extend that column to fill the extra space and allow the other columns to keep their auto width :)


Examples related to html

Embed ruby within URL : Middleman Blog Please help me convert this script to a simple image slider Generating a list of pages (not posts) without the index file Why there is this "clear" class before footer? Is it possible to change the content HTML5 alert messages? Getting all files in directory with ajax DevTools failed to load SourceMap: Could not load content for chrome-extension How to set width of mat-table column in angular? How to open a link in new tab using angular? ERROR Error: Uncaught (in promise), Cannot match any routes. URL Segment

Examples related to css

need to add a class to an element Using Lato fonts in my css (@font-face) Please help me convert this script to a simple image slider Why there is this "clear" class before footer? How to set width of mat-table column in angular? Center content vertically on Vuetify bootstrap 4 file input doesn't show the file name Bootstrap 4: responsive sidebar menu to top navbar Stylesheet not loaded because of MIME-type Force flex item to span full row width

Examples related to css-tables

How (and why) to use display: table-cell (CSS) height: 100% for <div> inside <div> with display: table-cell css display table cell requires percentage width space between divs - display table-cell Why is width: 100% not working on div {display: table-cell}? Controlling Spacing Between Table Cells Setting a max height on a table How to apply CSS page-break to print a table with lots of rows? How is a CSS "display: table-column" supposed to work? What replaces cellpadding, cellspacing, valign, and align in HTML5 tables?