If the size of an element, say for this case - a body element, is not known or it can be mentioned in any of the mentioned formats mentioned here: https://developer.mozilla.org/en-US/docs/Web/CSS/width, is it possible to get the size of the containing element for that element?
For example:
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<section>
<p id="test">This is a paragraph!</p>
</section>
</body>
</html>
Here say size of body is set to 50% or 300px, how can I get the size of the whole document? Apologize if this is stupid, new to this side of things. This is not a duplicate of How to find the width of a div using vanilla JavaScript?, because I am asking for the width of a container element and not the element itself.