1

How to set div and everything inside of that div (images, text) as percent of current size? This would be for something used in different views of products tile in an e-commerce store.

SIr Codealot
  • 5,331
  • 9
  • 33
  • 45

2 Answers2

0

Well, if you've got a div that wraps some other divs, or images, make the wrapping div 100%, then make sure the elements it contains add up to 100%. So, five divs inside one, placed next to each other (floated) is 20% each.
This is because 100% refers to the width of the wrapping block. Watch out for behavior of margin, padding and borders, because they play a role in the dimensions as well. A good way to overcome problems with this, is to fill your wrapper div with other wrapper divs, which in turn contain the 'real' content which can be styled to your liking without problems (MOST of the time)...

kasimir
  • 1,506
  • 1
  • 20
  • 26
0

this is a good ref to see how one might resize the font proportional to window size which could be easly change to a element

http://jaredstein.org/resources/stein/js/fonter.html

also have a look at Proportional image resize

Community
  • 1
  • 1
david
  • 4,218
  • 3
  • 23
  • 25