简体   繁体   中英

same [not-fixed] width of same column in multiple tables in HTML

I have several tables on the same page, each with the same number of columns. I want the first column in all the tables to have the same width, likewise for the second, etc. I do not want to specify a fixed width (eg, 100px), but rather let the browser calculate it. How can I accomplish this in HTML/XHTML/CSS/js?

You could just specify the width to be a % of the total page width in the CSS. Assign the same class to the first column in all the tables and set width: 15%; This isn't ideal however as the layout will vary based on a client's resolution. You're better off using a fixed width with position: fixed;

see CSS class position

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM