?" />

带 div 块且不带

发布于 2024-10-09 00:57:32 字数 1224 浏览 1 评论 0 原文

我并不是说使用 调整大小,尽管它的外观与我的目标相同。我想要此处中的僵尸狗代码但对于任意大小的图像。请阅读我的代码中的注释。

<?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>

I don't mean the resize using <img src="URL" width="Xy%" height="za%">, despite its look is the same with my goal. I want something like in the zombie-dog code here but with arbitrary-sized images. Please, read the comments in my code.

<?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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

标点 2024-10-16 00:57:32

不太确定我理解你的问题,但这行得通吗?

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

这会将 Zombiecontainer div 中任何图像的高度和宽度设置为您定义的任何值(在本例中为 div 的 50%)。

Not quite sure I understand your question, but will this work?

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

This will set the height and width of any image in the zombiecontainer div to whatever values you define (in this case 50% of the div).

悸初 2024-10-16 00:57:32

我将解决 Piontek Media 未解决的一个小问题。如果您希望图像像示例中那样居中,则需要以下内容,因为它不能位于图像块内。

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

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

如果您可以更简洁地做到这一点,请告诉我。

I will address a minor issue that Piontek Media did not address. If you want the image is centered like in the example, you need the below because it cannot be inside the image block.

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

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

If you can do it more succinctly, please, let me know.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文