An easy HTML trick for getting an image to scale to the size of a Placeholder content window

22 views
Skip to first unread message

Robb Price

unread,
Aug 11, 2010, 9:31:07 AM8/11/10
to Rise Vision
A really simple Gadget example is one that just shows an image from a
repository.

Here is the Content code for the Gadget:
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Transparent Logo" />
<Content type="html"><![CDATA[
<img src="https://dl.dropbox.com/u/8237394/rise-logo.png"/>
]]></Content>
</Module>

You can see that the img src points to the image, and that is all the
Gadget does. However, what if you want to put this image into
different Placeholders that are all different sizes, there is a very
easy trick to get it to scale to fit into any Placeholder you put it
into.

Just add this small portion of code to the end of the img src line:
style="width:100%;height:100%;"

Now your Gadget looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Transparent Logo" />
<Content type="html"><![CDATA[
<img src="https://dl.dropbox.com/u/8237394/rise-logo.png" style="width:
100%;height:100%;"/>
]]></Content>
</Module>

Now you can put that Gadget into any Placeholder, and it will scale to
fit every time!
Reply all
Reply to author
Forward
0 new messages