Home > Web Front-end > HTML Tutorial > Fixed table width table-layout: fixed_HTML/Xhtml_webpage production

Fixed table width table-layout: fixed_HTML/Xhtml_webpage production

WBOY
Release: 2016-05-16 16:37:48
Original
1296 people have browsed it

In order to allow the table to fill the screen (the remaining blank area), its width attribute is often defined as: 100%, and the cells are also defined as percentages.

But this will cause problems: If the text in the cell exceeds the width limit, it will automatically wrap and the height will automatically increase, resulting in uneven styles of the entire table and making it ugly.

The easy solution is to disable text wrapping: white-space:nowrap; overflow:hidden;

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

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

Ever since, I found the ultimate solution effortlessly: Fixed table width: table-layout: fixed;

By the way, I made a simple rendering, for reference:

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template