html - CSS - Use calc() to keep widths of elements the same -
is 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 div same width elementone.
is there such feature in css, using calc() or other means?
no, it's not possible css.
for have use javascript (document.getelementbyid(elementone).offsetwidth or similar, depending on width looking for). calc used math, not execute scripts. there no way of putting js in css statement, trying do.
for more on js bit, see how retrieve html element's actual width , height?
edit: background on why bad idea implement in css, se value calculation css (tl;dr: has been tried. things exploded)
Comments
Post a Comment