Fixed table width table layout: fixed

Time:2020-2-16

In order to allow the table to fill the screen (the remaining blank area), the width attribute is often defined as 100%, and the cell is also defined as a percentage.

But this will cause problems: if the text in the cell exceeds the width limit, it will automatically wrap lines and increase the height, resulting in the uneven style of the whole table, which is very ugly.

It’s easy to think of a solution: disable text wrapping: white space: nowrap; overflow: hidden;

So easy! But the effect is still unexpected: the text is displayed in one line, the width is widened automatically, even beyond the parent container, overflow has no effect at all!

What’s going on? Why percentage? But if you use static fixed width, you lose the flexibility of the table.

Thus, it is easy to find the ultimate solution: fixed table width: table layout: fixed;

By the way, I made a simple rendering, which is as follows:

Recommended Today

[Redis5 source code learning] analysis of the randomkey part of redis command

baiyan Command syntax Command meaning: randomly return a key from the currently selected databaseCommand format: RANDOMKEY Command actual combat: 127.0.0.1:6379> keys * 1) “kkk” 2) “key1” 127.0.0.1:6379> randomkey “key1” 127.0.0.1:6379> randomkey “kkk” Return value: random key; nil if database is empty Source code analysis Main process The processing function corresponding to the keys command is […]