Using Calc() with Tables: Overcoming Percentages Dilemma
Creating tables with both fixed and variable-width columns can be challenging, especially when attempting to use the calc() function within them.
In HTML, setting fixed column widths is straightforward using px or em. However, for variable-width columns, the percentage (%) unit is often used. However, when employing calc() within tables, percentages seem ineffective.
To overcome this limitation, the table-layout attribute can be applied to the table. This attribute enforces fixed widths for child td elements, allowing CSS percentages to work as intended.
HTML:
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3