html – Coudn't figure out why my container width is not being displayed as it should be-ThrowExceptions

Exception or error:

i gave a container div 400 pixels width but it is not actually taking 400px of the screen as it should , here is a screeshots showing what i mean
enter image description here

here is the code :

document.getElementById('player').style.height = '100%' ; 

document.getElementById('player').style.width = '100%'
body {
 width : 400px;
 height : 800px;
 background-color : red
<div id="player"></div>
How to solve:

one should be position absolute, and the other position relative. this should work

Leave a Reply

Your email address will not be published. Required fields are marked *