简体   繁体   English

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

[英]How to set the size of a desktop gadget that you create

I am trying to create a very basic windows desktop gadget to display my Stack Overflow Flair. 我正在尝试创建一个非常基本的Windows桌面小工具来显示我的Stack Overflow Flair。

I do not have much experience with html or web development. 我在html或Web开发方面经验不足。 I have tried to follow the instructions here , but when I install the gadget it is tiny: 我尝试按照此处的说明进行操作,但是在安装小工具时,它很小:

在此处输入图片说明

Yes, it's that tiny white square. 是的,那是一个很小的白色正方形。

I have tried setting a background image but it doesn't seem to work either (I don't actually need a background image, I was just trying to get it to work). 我尝试设置背景图像,但是它似乎也不起作用(我实际上不需要背景图像,我只是想使其工作)。 If I run the html source file stand alone then it displays correctly in a browser: 如果我单独运行html源文件,则它会在浏览器中正确显示:

在此处输入图片说明

Here is the code from the html source file (named MySOFlair.html): 这是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>

Here is the code from the manifest file (Gadget.xml): 这是清单文件(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>

I have tried uncommenting the image links in here, but it doesn't change anything. 我尝试取消注释此处的图像链接,但它没有任何改变。

Any ideas on how to set the size correctly would be greatly appreciated. 任何有关如何正确设置尺寸的想法将不胜感激。

I have found how to fix this. 我已经找到解决方法。 I found a style element that could be inserted into the HTML header section. 我发现可以插入HTML标头部分的样式元素。 Here is the new HTML file: 这是新的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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无论上传的图像大小如何,如何将动态创建的bootstrap Carousel图像的大小设置为桌面大小 - How to set the size of dynamically created bootstrap Carousel images to desktop size regardless of uploaded image size 如何在 Tailwind 中创建具有设定大小的 div CSS - How to create a div with set size in Tailwind CSS 如何使设置的文本大小填充容器 - How do you make a set text size fill a container 在 html 和 css 中如何将 body 设置为屏幕的全尺寸? - How do you set the body to the full size of the screen in html and css? 如何在graphviz中设置HTML字体大小? - How do you set the HTML font size in graphviz? 你如何为视频设置手机和桌面的 data-src - How do you set data-src for phone vs. desktop for a video Windows桌面小工具RSS Feed颜色编码项 - Windows desktop gadget RSS Feed colour coding items 如何创建一组下拉列表,使列表随着您的选择而减少? - How to create a set of dropdowns where the list reduces as you select? 为移动设备、桌面设备和打印设备设置字体大小的最佳方法是什么? - What is the best way to set font size for mobile, desktop, and print? 在桌面上设置图片大小,但在使用移动设备时调整大小 - Set image size on desktop, but resize when using mobile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM