Tip: Express sizes with percentages

Wednesday, July 25, 2007 at 3:57 PM



For a resizable gadget, it's often easiest to set the width or height of inner elements to 100%. That way when the view or outer element is resized, the inner elements adjust size accordingly. For example:
<div width="50" height="50">
<label width="100%" height="100%" size="8"></label>
</div>
When the div's size changes, the label is automatically resized to match the div.

Have a tip you'd like to share? Send it to gd-developer AT google DOT com.

2 comments:

Bijoy Thangaraj said...

Really useful tip. Thanks for posting James. I've used this feature in many of my gadgets and they are really helpful.

Unknown said...

Great Tip! :)

Thanks James..!