(minimum) width td, which optionally contains an image

How can you provide a minimum width for a TD, which may optionally contain an image? I ask this because I use the Javascript chess widget, but when there are no pieces in any of the squares of a particular column, no matter which td width style is set to 36px, this column is significantly narrower than those that have at least , one line containing an image of a chess piece.

Note that the whole style is set directly in each td cell. I read somewhere that a possible solution would instead be to create a div inside td and set the width. I hope to avoid this, as this may require significant changes to the Javascript core library. I tried to clarify! It is important along with the width, but it did not affect.

Using firebug, I can change the width attribute, but the numbers seem to be wrong. For example, I can reduce the width to 0, and it still looks the same. Or I can set the width to more than 36 and, apparently, increase the width to -36, but if, for example, I set both the height and the width of one of these narrow cells to the same number, say 60 pixels , the height of which is displayed more than the width and displayed as a rectangle, not a square.

In addition, not only td can contain an image, but each square also defines a background image. So I'm at a loss :( Thanks in advance

+3
source share
3 answers

When I modify the CSS in your file using Firebug or the JS inspector in Chrome, setting the property min-widthinstead of the property widthdoes the trick. Can you try Not sure how IE will like it.

BTW: Why not use classes for CSS? It's kind of terrible to debug this way.

+7
source

By default, tables will automate the size of columns.

If you set the table style, enable:

table-layout: fixed;

then it will be much better for you to control it with CSS and attributes.

+5
source

width td tags css .

-2

Source: https://habr.com/ru/post/1756445/


All Articles