1

<img src="URL" width="Xy%" height="za%">見た目は私の目標と同じですが、を使用してサイズ変更するという意味ではありません。ここのゾンビドッグコードのようなものが欲しいのですが、任意のサイズの画像が必要です。私のコードのコメントを読んでください。

<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="" />

<Content type="html">
<![CDATA[

// This won't change the size of the image but the size of div.

<style type="text/css">
#zombiecontainer{
height:100%;
width:100%;
}
</style>

// I want to specify the size of the image with Div -block relative to the size
// of iGoogle gadget.

<div id="zombiecontainer"
style="text-align:center;" width="100%" height="100%">
</div>


<script type="text/javascript">
var images = new Array();
images[0] = _IG_GetImage("https://pictures/friends.jpg");

// How can I do it with the div? I don't want to create a static picture
// and put the code to the div block. I want to be able to change it,
// hopefully, with below commands. No more messy HTML.

_gel("zombiecontainer").innerHTML = "";
_gel("zombiecontainer").appendChild(images[0]);

</script>
</div>
]]>
</Content>
</Module>
4

2 に答える 2

1

私があなたの質問を理解しているのかよくわかりませんが、これはうまくいくでしょうか?

<style type="text/css">
#zombiecontainer img{
height:50%;
width:50%;
}
</style>

これにより、zombiecontainer div内の画像の高さと幅が、定義した値(この場合はdivの50%)に設定されます。

于 2010-12-23T04:26:17.833 に答える
0

PiontekMediaが対処しなかったマイナーな問題に対処します。例のように画像を中央に配置する場合は、画像ブロック内に配置できないため、以下が必要です。

<style type="text/css">
#zombiecontainer img{
height:50%;
width:50%;
}

#zombiecontainer {
text-align:center;
}
</style>

もっと簡潔にできたら教えてください。

于 2010-12-25T01:15:35.787 に答える