height 156px is equivalent to 102px padding-bottom so which do you use and why?
(1st Code) I replace padding bottom with height. Is that a good thing to do? And is there a difference between setting height, instead of padding for bottom?
I think you know enough by now to answer this question.
Padding is the space that you put around content. Height is the space for the content (minus padding and borders).
Padding-bottom of 100px will create the same effect as height:100px (without padding) except when you add content.
Content never encroaches on the padding area (unless it overflows) and the padding-bottom of 100px will always be maintained.
Height:100px will initially create the same height box as padding-bottom:100px except that when you place content in the box it will not have any padding around it
Setting fixed pixel heights on anything restricts the flexibility of the layout. Yes, you can use it to achieve a very precise layout design on whatever viewport size you happen to be working with, but it will not be a flexible arrangement when that viewport size is changed - for example on a phone or tablet.
Also, if you set fixed dimensions, you must be conscious of how much content you put inside the box. If you put too much into it, the additional content will overflow, and likely break your nice neat layout. Personally, I’d use padding, then leave the box size flexible by setting all the dimensions using percentages.
This is obviously a very challenging exercise. Suppose we put two tables side-by-side and compare how they behave when the same text is added to both.
The challenge for asasass is to decide which behavior he prefers… the one with the height but no padding, or the one with the padding but no height.
You must have your font size set unusually small; in fact I’m sure you do. None of your other posts show the font to be that small. Yeah, you reduced the font size down from 30px to 20px. Intentionally sabatoging the demo… and then you state
but they didn’t initially, You would have had no reason to reduce the font size had they both looked the same. Anyone else can run the code that I posted and see that.
Because (as @PaulOB explained) padding adds a fixed amount of padding within the border, and that remains the same no matter what happens to the text size. Height fixes the minimum height; if your content is less than that height, then there will be empty space at the bottom, but as your content increases, it will fill the space, and then stretch the table cell to fit.
This is one reason why I keep saying how important it is to know what content you intend to place in a container while building a layout; different approaches behave differently.