html - 如何设置您创建的桌面小工具的大小

标签 html windows windows-7 windows-desktop-gadgets

我正在尝试创建一个非常基本的 Windows 桌面小工具来显示我的 Stack Overflow Flair。

我在 html 或 web 开发方面没有太多经验。我已尝试按照说明进行操作 here ,但是当我安装小工具时它很小:

enter image description here

是的,就是那个白色的小方 block 。

我试过设置背景图片,但它似乎也不起作用(我实际上并不需要背景图片,我只是想让它起作用)。如果我单独运行 html 源文件,那么它会在浏览器中正确显示:

enter image description here

这是来自 html 源文件(名为 MySOFlair.html)的代码:

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  </head>

  <body>
    <div id="gadgetContent">
      <a href="http://stackoverflow.com/users/2012446/chrisprosser">
        <img src="http://stackoverflow.com/users/flair/2012446.png" width="208" height="58" 
             alt="profile for ChrisProsser at Stack Overflow, Q&amp;A for professional and enthusiast programmers" 
             title="profile for ChrisProsser at Stack Overflow, Q&amp;A for professional and enthusiast programmers"/>
      </a>
    </div>
  </body>
</html>

这是来自 list 文件 (Gadget.xml) 的代码:

<?xml version="1.0" encoding="utf-8" ?>
<gadget>
  <name>MySOFlair</name>
  <version>1.0.0.0</version>
  <author name="Chris Prosser" />
  <description>Mt Stack Overflow Flair Gadget</description>
  <!--<icons>
    <icon src="http://stackoverflow.com/users/flair/2012446.png" 
          width="208" 
          height="58" />
  </icons>-->
  <hosts>
    <host name="sidebar">
      <base type="HTML" apiVersion="1.0.0" src="MySOFlair.html" />
      <permissions>Full</permissions>
      <platform minPlatformVersion="1.0" />
      <!--<defaultImage src="http://stackoverflow.com/users/flair/2012446.png" 
                    width="208" 
                    height="58"/>-->
    </host>
  </hosts>
</gadget>

我已经尝试取消注释此处的图片链接,但它没有任何改变。

如有任何关于如何正确设置尺寸的想法,我们将不胜感激。

最佳答案

我已经找到了解决这个问题的方法。我找到了一个可以插入到 HTML 标题部分的样式元素。这是新的 HTML 文件:

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    body
    {
       margin:  0;
       width: 212;
       height: 62;
    }
    #gadgetContent
    {
       margin:  0px;
       width: 208px;
       height: 58px;
    }
    </style>
  </head>

  <body>
    <div id="gadgetContent">
      <a href="http://stackoverflow.com/users/2012446/chrisprosser">
        <img src="http://stackoverflow.com/users/flair/2012446.png" width="208" height="58" 
             alt="profile for ChrisProsser at Stack Overflow, Q&amp;A for professional and enthusiast programmers" 
             title="profile for ChrisProsser at Stack Overflow, Q&amp;A for professional and enthusiast programmers"/>
      </a>
    </div>
  </body>
</html>

关于html - 如何设置您创建的桌面小工具的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18810504/

相关文章:

windows - 用于查看组合字符串和 float 据的十六进制编辑器

c# - 开发文件存储 Web 应用程序

linux - Linux 与 Windows 中的 WMIC 差异

html - 顶部边框和文本问题

html - 尝试在居中元素中左对齐文本

html - 向左浮动和父高度

.net - 是否有用于查询 Windows 7 Media Center 收视指南的 .Net API?

jquery - 如何在页面刷新时保留<form>中的 'input',或者停止页面刷新?

c# - 查询事件日志时的越权操作

c++ - DeviceIoControl 调用崩溃