With 'width' we can set the width of an element, either in absolute (px) or in relative (%, em) units. Negative valuees are not allowed.

width:150px;
width:50%;

Width in relative units (like width:50%; works, it will be taking the width from the parent element (that element that contains this element). Like so:

<div style="width:500px; height:200px; ">
Hello, I am 500 pixels wide and contain another div (that makes it a child element).
<div style="width:40%; height:100%; ">
Hello, I am the child and I have my width set to 40%.
</div>
</div>
Hello, I am 500 pixels wide and contain another div (that makes it a child element).
Hello, I am the child and I have my width set to 40%.

It results in the height getting set to 'auto', which means as tall as the content inside needs the box to be.