On 12/3/2011 1:42 PM, Stevio wrote:
Somehow I do not seem to have come across this problem before. I have two divs, one contained within the other. If the viewport of the browser is resized to be smaller than the contents of the inner div, the inner div sticks out the side of the outer container div, which continues to resize with the browser.

Surely the outer div should stop shrinking when it reaches the width of its inner div, even if the viewport continues to be shrunk?

How can I fix this so that the outer div will not become any smaller than the width of its inner div, when the width of the inner div will be unknown?

Here is example code that illustrates this. In my example, the inner div is set to a fixed width, but for the web site I am developing, I will not know the width of the inner div.


<!DOCTYPE html>
<html><head><title>Test</title>
<style type="text/css">
#wrap {
background:#CCC;
border:2px solid blue;
}
#contents {
width: 800px;
That is the problem right there, use either % or em units for defining the widths of stuff a part from images and borders and that problem should go away.



*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
*******************************************************************

Reply via email to