Resize table cell max-width

I have a table in which the name of the camera and its model will be displayed. The problem is that the name / model string is too long when the cell gets the size and therefore the body of the table does not synchronize with the head.

<td> <div class="camera_details"> <div class="camera_models">XXXCAMERAMODELXXX</div> <div class="camera_name">XXXCAMERANAMEXXX</div> </div> </td> 

This hass css looks like this:

 td{ max-width: 144px; } .camera_details { max-width: 144px; } .camera_models { text-overflow: ellipsis; overflow: hidden; } .camera_name { text-overflow: ellipsis; overflow: hidden; } table { table-layout: fixed; } 

The problem exists only in IE8, where the div gets constrained due to max-width, but the td element does not still cause misalignment in the table.

Can I make td be a specific width regardless of the width of the child divs?

+6
source share
2 answers

Define table-layout: fixed; in table . Write like this:

 table{ table-layout:fixed; } 
+2
source

You can apply the following styles to your div :

 overflow: hidden; white-space: nowrap; 

You also need to specify width .

0
source

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


All Articles