One of the divs should be a container for the other. Float the inner div and set the margin on the outer div to match the width of the inner. This will allow the contents of each div to show where necessary, horizontally. Then set the height of the inner layer to 100% so that it always fills the vertical space on the outer div and can stretch it if necessary.
source
share