Overflow: hidden is often used to hide overflowing content within an element. However, when applied to a
To resolve this issue, two additional CSS properties are required:
Example:
Consider the following HTML and CSS snippets:
<table> <tbody> <tr> <td> This_is_a_terrible_example_of_thinking_outside_the_box. </td> </tr> </tbody> </table>
* { box-sizing: border-box; } table { table-layout: fixed; border-collapse: collapse; width: 100%; max-width: 100px; } td { background: #F00; padding: 20px; overflow: hidden; white-space: nowrap; width: 100px; border: solid 1px #000; }
In this example, the table element has a fixed maximum width of 100px, and the
The above is the detailed content of Why Doesn't `overflow: hidden` Work on a Element, and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!