<i id='UfzRj'><tr id='UfzRj'><dt id='UfzRj'><q id='UfzRj'><span id='UfzRj'><b id='UfzRj'><form id='UfzRj'><ins id='UfzRj'></ins><ul id='UfzRj'></ul><sub id='UfzRj'></sub></form><legend id='UfzRj'></legend><bdo id='UfzRj'><pre id='UfzRj'><center id='UfzRj'></center></pre></bdo></b><th id='UfzRj'></th></span></q></dt></tr></i><div id='UfzRj'><tfoot id='UfzRj'></tfoot><dl id='UfzRj'><fieldset id='UfzRj'></fieldset></dl></div>

    <legend id='UfzRj'><style id='UfzRj'><dir id='UfzRj'><q id='UfzRj'></q></dir></style></legend>
      <bdo id='UfzRj'></bdo><ul id='UfzRj'></ul>

    1. <tfoot id='UfzRj'></tfoot>
      1. <small id='UfzRj'></small><noframes id='UfzRj'>

        使用 CSS/HTML 更改悬停图像

        Changing image on hover with CSS/HTML(使用 CSS/HTML 更改悬停图像)

        • <bdo id='0uGwf'></bdo><ul id='0uGwf'></ul>
                  <tbody id='0uGwf'></tbody>
              1. <i id='0uGwf'><tr id='0uGwf'><dt id='0uGwf'><q id='0uGwf'><span id='0uGwf'><b id='0uGwf'><form id='0uGwf'><ins id='0uGwf'></ins><ul id='0uGwf'></ul><sub id='0uGwf'></sub></form><legend id='0uGwf'></legend><bdo id='0uGwf'><pre id='0uGwf'><center id='0uGwf'></center></pre></bdo></b><th id='0uGwf'></th></span></q></dt></tr></i><div id='0uGwf'><tfoot id='0uGwf'></tfoot><dl id='0uGwf'><fieldset id='0uGwf'></fieldset></dl></div>

                  <small id='0uGwf'></small><noframes id='0uGwf'>

                1. <tfoot id='0uGwf'></tfoot><legend id='0uGwf'><style id='0uGwf'><dir id='0uGwf'><q id='0uGwf'></q></dir></style></legend>
                  本文介绍了使用 CSS/HTML 更改悬停图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有这个问题,我设置了一个图像以在鼠标悬停时显示另一个图像,但是第一个图像仍然出现,新的图像不会改变高度和宽度并与另一个图像重叠.我对 HTML/CSS 还是很陌生,所以我可能错过了一些简单的东西.代码如下:

                  I have this problem where I have set an image to display another image when the mouse hovers over, however the first image still appears and the new one doesn't change height and width and overlaps the other one. I'm still pretty new to HTML/CSS so I may have missed something simple. Here is the code:

                  <img src="LibraryTransparent.png" id="Library">
                  

                  #Library {
                      height: 70px;
                      width: 120px;
                  }
                  
                  #Library:hover {
                      background-image: url('LibraryHoverTrans.png');
                      height: 70px;
                      width: 120px;
                  }
                  

                  推荐答案

                  一种解决方案是同时使用第一张图片作为背景图片,如下所示:

                  One solution is to use also the first image as a background image like this:

                  <div id="Library"></div>
                  

                  #Library {
                     background-image: url('LibraryTransparent.png');
                     height: 70px;
                     width: 120px;
                  }
                  
                  #Library:hover {
                     background-image: url('LibraryHoverTrans.png');
                  }
                  

                  如果您的悬停图像大小不同,您必须像这样设置它们:

                  If your hover image has a different size, you've got to set them like so:

                  #Library:hover {
                     background-image: url('LibraryHoverTrans.png');
                     width: [IMAGE_WIDTH_IN_PIXELS]px;
                     height: [IMAGE_HEIGHT_IN_PIXELS]px;
                  }
                  

                  这篇关于使用 CSS/HTML 更改悬停图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  How do I make a TextGeometry multiline? How do I put it inside a square so it wraps like html text does inside a div?(如何制作 TextGeometry 多线?如何将它放在一个正方形内,以便它像 html 文本一样包裹在 div 内?) - IT屋-程序员软件开发技术分享社
                  Scale background image to fit ie8 window(缩放背景图像以适合 ie8 窗口)
                  @fontface in IE7 (IETEster) not working properly(IE7 (IETEster) 中的@fontface 无法正常工作)
                  Safari 5.1 breaks CSS table cell spacing(Safari 5.1 打破 CSS 表格单元格间距)
                  Put in bold part of description in metatag Drupal module(将描述的粗体部分放在元标记 Drupal 模块中)
                    <tbody id='2LucM'></tbody>
                    <i id='2LucM'><tr id='2LucM'><dt id='2LucM'><q id='2LucM'><span id='2LucM'><b id='2LucM'><form id='2LucM'><ins id='2LucM'></ins><ul id='2LucM'></ul><sub id='2LucM'></sub></form><legend id='2LucM'></legend><bdo id='2LucM'><pre id='2LucM'><center id='2LucM'></center></pre></bdo></b><th id='2LucM'></th></span></q></dt></tr></i><div id='2LucM'><tfoot id='2LucM'></tfoot><dl id='2LucM'><fieldset id='2LucM'></fieldset></dl></div>

                    <small id='2LucM'></small><noframes id='2LucM'>

                  • <tfoot id='2LucM'></tfoot>

                        <legend id='2LucM'><style id='2LucM'><dir id='2LucM'><q id='2LucM'></q></dir></style></legend>
                          <bdo id='2LucM'></bdo><ul id='2LucM'></ul>