Warning: Undefined array key "StartingPoint" in /customers/f/f/0/safaribears.de/httpd.www/content.php on line 107 Warning: Cannot modify header information - headers already sent by (output started at /customers/f/f/0/safaribears.de/httpd.www/content.php:107) in /customers/f/f/0/safaribears.de/httpd.www/content.php on line 115 Warning: Undefined variable $WEB_ROOT in /customers/f/f/0/safaribears.de/httpd.www/content.php on line 118 Warning: Cannot modify header information - headers already sent by (output started at /customers/f/f/0/safaribears.de/httpd.www/content.php:107) in /customers/f/f/0/safaribears.de/httpd.www/content.php on line 118 Warning: Undefined array key "HTTP_ACCEPT_LANGUAGE" in /customers/f/f/0/safaribears.de/httpd.www/content.php on line 169 CSS Tutorial - Dimensions - width

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.