How can I make a div element "float" up when resizing the browser window using css and html?

Viewed 1555

I have been trying to figure this out, but am unable. I am looking for a way (through coding html/css) to "float" a div element up as the browser window's width is decreased.

Here is the browser window at full width with the div elements side by side.

Wide layout

After resizing (decreasing browser window width), I'd like for the 2nd div element to "float" above the 1st div element.

Narrow layout

I would appreciate any help. Thank you.

UPDATE: First, thank you all for the help. After reading/trying recommendations, I am looking for a solution that is functional across all browsers. Also, the elements will be dynamic images. And, it doesn't have to be strictly limited to html/css, but the most simplistic implementation is always appreciated! :) Thank you again for your input and help.

5 Answers
Related