I want to read the dimensions of a div. Placing its height and width in two variables. Further down the html code I want to use those variables to e.g. place them into style tags with an echo command like:
<p style="margin-top: ([divwidth] / 2) px;">text</p>
Javascript is the only way to read the dimensions of a div? Or can it also be done with php so I could use echo commands to insert the variables into the html style tag?
If it can only be done through javascript, I can't use it cause I can't put a script tag inside the style tag to e.g. use a document.write command. Then I would somehow pass the width variable to php.
How else could I do this?