In the same example if we drag the HTML output part and increase the width to 800 or more then 200px width property of TDs come into action. display: flex on the parent element also changes how width and height work.

Recently someone asked a question somewhere along these lines, and got me wondering.In this fiddle, if you were to check its width (I'm using inspect element from chrome), it shows Lets add a few more "td"s in, and we shall see that the "But let's say, I move back to fewer TD's (7), and I add in a wider width to each TD element (500px), the result is that the width of the td gets stuck at And finally, let's say I have a table of 2000px width, and td of Now the table width overrides the TD width, and expands the td's width to p.s. Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python, Bootstrap, Java and XML. Featured on Meta Some email clients do not support the 'display' css property. Also, what are the effects of position:fixed, absolute etc have on td widths if any? According to the w3 Docs Here It says "In the absence of any width specification, table width is determined by the user agent.". Which you could see, if you pull out about 45 of your td's in each tr, (i.e. html - column - td width percentage not working I'll just add it as an answer I think you don't understand my answer. Let’s see how this used to be done with the widthattribute and then we’ll look at how the same thing can now be done with CSS.

As you can see, in this firs…

I am looking for a reason more than a fix.

Where developers & technologists share private knowledge with coworkersProgramming & related technical career opportunitiesyou could try. By clicking “Post Your Answer”, you agree to our To subscribe to this RSS feed, copy and paste this URL into your RSS reader. Sometimes i'm not saying you are wrong. See Great answer, but there's one thing to supplement: @He Hui -> You are a genius sir! And each td is 200px wide. Then TDs will take whatever is define for TD (because now they don't have any table width to consider) and Table width will be the combination of all the TDs widths. And then check my answer.Check the above code to your local server. And only when the total width of the TD's is smaller than that of the viewport, the elemental width will be taken into account.Stated TD width will only be followed until it exceeds viewport width, and viewport width will be taken as priority.Actually the table width depends on the cell width when you do not specify the table width. Well i guess then it depends on the width of the parent element.

Hope this makes it clear, Check here This is new to me.

Was not aware of this scenario. However, if the width is unset, the "main" width will be the true width of the viewport. Test this on your local server, a table with 20 td's. It just becomes really small blocks of images, which is not how it looks for Nick when he typed up his css file. The reason, is, because you did not specify the width of the table, and your whole bunch of td's are overflowing. Like in your example when you added 4 TDs then available width was less then 800px so TD's width was adjusted according to available width and 200px property was ignored. If you have a table with width 500px and 2 TDs with width 200px each. your coworkers to find and share information. By using our site, you acknowledge that you have read and understand our I'm merely saying you're only partially true. No table width defined. Brian Pontarelli. site design / logo © 2020 Stack Exchange Inc; user contributions licensed under