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

    • <bdo id='0VY0G'></bdo><ul id='0VY0G'></ul>
    <tfoot id='0VY0G'></tfoot>

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

        如何使用css在悬停时在图像上显示图像

        时间:2023-11-01
        <i id='69vJU'><tr id='69vJU'><dt id='69vJU'><q id='69vJU'><span id='69vJU'><b id='69vJU'><form id='69vJU'><ins id='69vJU'></ins><ul id='69vJU'></ul><sub id='69vJU'></sub></form><legend id='69vJU'></legend><bdo id='69vJU'><pre id='69vJU'><center id='69vJU'></center></pre></bdo></b><th id='69vJU'></th></span></q></dt></tr></i><div id='69vJU'><tfoot id='69vJU'></tfoot><dl id='69vJU'><fieldset id='69vJU'></fieldset></dl></div>
          <tbody id='69vJU'></tbody>
          <legend id='69vJU'><style id='69vJU'><dir id='69vJU'><q id='69vJU'></q></dir></style></legend>

        1. <tfoot id='69vJU'></tfoot>

          <small id='69vJU'></small><noframes id='69vJU'>

                  <bdo id='69vJU'></bdo><ul id='69vJU'></ul>
                  本文介绍了如何使用css在悬停时在图像上显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个带有

                  <a href="#"><img src="http://placekitten.com/100/100"/></a>一个 {位置:相对;显示:内联块;}一个:悬停:之前{内容: '';显示:块;背景:rgba(255, 0, 0, .5);/* 你的背景 */宽度:20px;/* 图像宽度 */高度:100px;/* 图像高度 */位置:绝对;顶部:0;右:0;}

                  I have a gallery of images with links.

                  Edit: Here's the code I have to work with:

                  <div class="gallerypagetabs"><a href="http://costumingdiary.blogspot.com/2013/01/victorian-tardis-purse.html"><img alt="Free Victorian Purse Pattern" src="https://lh3.googleusercontent.com/-m4y6eS2KGRQ/Ug7TKD3sbYI/AAAAAAAAHNc/6qoeuGedjOY/s200-c/free-victorian-purse-pattern-1.jpg"><br>Free Victorian Purse Pattern</a><a href="http://costumingdiary.blogspot.com/2012/12/natural-form-victorian-overskirt.html"><img alt="Natural Form Victorian Overskirt" src="https://lh3.googleusercontent.com/-ZrTDaXEOiiU/US__mPzz3dI/AAAAAAAADWQ/eBm3tO3P8oI/s200-c/IMG_5482%255B6%255D.jpg"><br>Natural Form Victorian Overskirt</a><a href="http://costumingdiary.blogspot.com/2012/11/truly-victorian-tv221-1878-tie-back.html"><img alt="Truly Victorian TV221 1878 Underskirt Pattern Review" src="https://lh4.googleusercontent.com/-GmrRTxJ5NGY/UKfO_SQzymI/AAAAAAAAAHA/A9qx6czpyJk/s200-c/Truly-Victorian-TV221-1878-Tie-Back-%255B1%255D%255B4%255D.png"><br>Truly Victorian TV221 1878 Underskirt Pattern Review</a><a href="http://costumingdiary.blogspot.com/2012/10/truly-victorian-tv121-petticoat-pattern.html"><img alt="Truly Victorian TV121 Petticoat Pattern Review" src="http://lh4.ggpht.com/-qTsclIxCTKY/UH7fK3jqKII/AAAAAAAAodI/2GaQOVrGuuA/s200-c/Truly%252520Victorian%252520TV121%2525201879%252520Petticoat%252520with%252520Detachable%252520Train%25255B6%25255D.png?imgmax=800"><br>Truly Victorian TV121 Petticoat Pattern Review</a>..ad naseum..</div>
                  

                  CSS:

                  .gallerypagetabs a,.gallerypagetabs p{
                      float:left;
                      font-size:.80em;
                      height:250px;
                      padding:10px;
                      text-align: center;
                      width:200px
                  }
                  

                  What I'd like to do is show a transparent image with stars on them when someone hovers over the image. So if a person hovers over the Free Victorian Purse Pattern image, they'll see an image of - let's say - five stars indicating that the pattern has received a rating of 5 out of 5 stars from me.

                  I've tried both of the following with no luck. The code shows the image on hover, but it shows at the bottom of the image instead of overlapping it:

                  .gallerypagetabs a:hover{
                      background-image:url('http://i.imgur.com/IKAXZKz.png');
                      background-position:inherit
                   }
                  

                  AND

                  .gallerypagetabs a:hover{
                      background-image:url('http://i.imgur.com/IKAXZKz.png');
                      background-position:inherit;
                      z-index:10
                  }
                  

                  Any advice? I don't want to use Javascript, and I want to add as little coding to the HTML as possible cannot change the html other than adding another class or id at the beginning of it. It all has to be done through CSS. Here's how I'd like it to look. Thanks for your help!

                  The code that WORKS! (Thanks cimmanon!) (Changed gallerypagetabs to gallerypatterntab to isolate the class from the rest of the blog. Screenshot from Blogger - yeah Blogger likes to rewrite things like quotations)

                  解决方案

                  You can use a pseudo element for this purpose. No need for extra markup.

                  http://cssdeck.com/labs/anxnrkhr

                  <a href="#"><img src="http://placekitten.com/100/100" /></a>
                  
                  a {
                    position: relative;
                    display: inline-block;
                  }
                  
                  a:hover:before {
                    content: '';
                    display: block;
                    background: rgba(255, 0, 0, .5); /* your background */
                    width: 20px; /* image width */
                    height: 100px; /* image height */
                    position: absolute;
                    top: 0;
                    right: 0;
                  }
                  

                  这篇关于如何使用css在悬停时在图像上显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:通过 jQuery/Javascript 添加悬停 CSS 属性 下一篇:使用 JQuery 悬停项目

                  相关文章

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

                  <small id='5a9Nt'></small><noframes id='5a9Nt'>

                    <tfoot id='5a9Nt'></tfoot>
                      • <bdo id='5a9Nt'></bdo><ul id='5a9Nt'></ul>