CSS - Use calc() to keep widths of elements the same
问题 Is something like this possible in CSS? <table> <tr> <td id="elementOne">elementOne</td> <td id="elementtwo">elementtwo</td> </tr> </table> <div style="width: calc(document.getElementById(elementOne).width)"></div> So that the div is always the same width as elementOne . Is there such a feature in CSS, using calc() or some other means? 回答1: No, it's not possible with CSS. For that you will have to use JavaScript ( document.getElementById(elementOne).offsetWidth or similar, depending on