I am currently developing a small HTML page and I am utilizing JavaScript to retrieve the screen dimensions. However, I am facing an issue with passing this variable to a CSS style as shown below. How can I achieve this successfully? Additionally, I have observed that "px" needs to be appended at the end of the value for proper formatting, such as top: 100px instead of top:100. How can I incorporate this into my variable adjustment? Any assistance on this matter would be greatly appreciated.
<script type="text/javascript>
var percent =1;
var myWidth = Math.round(screen.width * percent);
var myHeight = Math.round(screen.height * percent);
</script>
<style type="text/css">
div.content {
margin: auto;
top: myHeight + 'px';
width: myWidth + 'px';
}
</style>