<small id='GBj8b'></small><noframes id='GBj8b'>

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

        <bdo id='GBj8b'></bdo><ul id='GBj8b'></ul>
    1. <tfoot id='GBj8b'></tfoot>
    2. <legend id='GBj8b'><style id='GBj8b'><dir id='GBj8b'><q id='GBj8b'></q></dir></style></legend>
      1. 如何在图像悬停中显示文本

        How to show text in image hover(如何在图像悬停中显示文本)

          <small id='E3DjN'></small><noframes id='E3DjN'>

        • <tfoot id='E3DjN'></tfoot>
            <bdo id='E3DjN'></bdo><ul id='E3DjN'></ul>

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

                <tbody id='E3DjN'></tbody>

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

                  问题描述

                  我有一些缩略图,我想在悬停时在它们上面显示一些文字.我可以让它们在悬停时变暗,但不知道如何添加文本.

                  I have a few tumbnails that I want to show some text on them in hover. I could make them dark in hover but do not know how to add text.

                  示例:http://www.lenzflare.com/video-production-portfolio/

                  这是我所做的:

                      a {
                      display: inline-block;
                      overflow: hidden;
                      position: relative;
                      }
                      a:hover .play {
                      background:url(http://goo.gl/yJqCOR) no-repeat center    center;
                      opacity: 0.8;
                      position: absolute;
                      width: 200px;
                      height: 200px;
                      left: 50%;
                      top: 50%;
                      margin-left: -110px;
                      margin-top: -150px;
                      }
                  
                  <a href="/">
                  <div class="play"></div>
                  <img class="img" src="http://i42.tinypic.com/2v9zuc1.jpg" />
                  <br />
                  </a>
                  

                  演示:http://jsfiddle.net/jmXdh/79/

                  推荐答案

                  好吧,我假设你想要这个列表:

                  Well I'm going to assume you want this in a list:

                  这里有几个主要概念:相对定位以及它如何与绝对定位、源顺序以及您的居中技术一起使用.

                  There are a few main concepts here: Relative positioning and how it works with absolute positioning, Source order, and your centering technique.

                  给予位置时:相对;对于盒子,你是在说我现在是边界——对于我内在任何绝对定位的东西".(除非它们是相对的,然后像下面那样) - 所以,你想要淡入的绝对定位的封面 - 绝对定位到相关框的一个或多个边缘.(大多数人使用 top: 0; left: 0;) --- 所以绝对框不再在流"中.并生活在由亲属决定的自己的魔法世界中.

                  When giving position:relative; to the box, you are saying "I am the boundary now - for any absolutely positioned things within me" (unless they are relative, and then like that on down the line) - So, the absolutely positioned cover thing you want to fade in - is absolutely positioned to one or more edges of the relative box. (most people use top: 0; left: 0;) --- so the absolute box is no longer in the "flow" and lives in it's own magic world determined by the relative parent.

                  源顺序:堆叠时您的 html 会出现自下而上.所以你的封面应该在图片下方(按 html 顺序) - 你可以使用 z-index - 但没有必要这样做.

                  Source order: your html will appear bottom up when stacking. so your cover thing should be below the image (in the html order) - you could use z-index - but there is no need to do that.

                  这里的负边距并不是很好,也不需要.您可以将文本居中对齐.我会做一些测试并在东西周围设置边界,这样你就可以看到它实际发生了什么.ALSO - 我鼓励你使用 box-sizing: border-box;关于一切......

                  The negative margins are not really awesome and unneeded here. You can just text align center them. I would do some tests and put borders around stuff so you can see what it actually happening. ALSO - I encourage you to use box-sizing: border-box; on everything...

                  阅读:边框

                  <ul class="thumbnail-list">
                  
                    <li>
                      <a href="#" class="image-w">
                        <img alt="thumbnail"
                             src="http://placekitten.com/600/300" />
                        
                        <div class="cover">
                          <h3>Title</h3>
                          <p>A little bit more about the thing</p>
                        </div>
                      </a>
                    </li>
                    
                  </ul> <!-- .thumbnail-list -->
                  

                  CSS

                  .thumbnail-list {
                    list-style: none;
                    margin: 0; paddingn: 0;
                  }
                  
                  .thumbnail-list li {
                    float: left;
                  }
                  
                  a {
                    text-decoration: none;
                    color: inherit;
                  }
                  
                  .thumbnail-list .image-w {
                    display: block;
                    position: relative;
                    width: 16em;
                  }
                  
                  .image-w img {
                    display: block;
                    width: 100%;
                    height: auto;
                  }
                  
                  .cover {
                    position: absolute;
                    top: 0; right: 0;
                    bottom: 0; left: 0;
                    width: 100%;
                    height: 100%;
                    color: rgba(255,255,255,0);
                    text-align: center;
                    transition: all 1s linear;
                  }
                  
                  .cover:hover {
                    background-color: rgba(0,0,0,.8);
                    color: rgba(255,255,255,1);
                    transition: all .2s linear;
                  }
                  
                  .thumbnail-list h3 {
                    font-size: 1.2em;
                  }
                  
                  .thumbnail-list p {
                    font-size: .9em;
                  }
                  

                  这里是 jsfiddle 上的代码

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

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

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)

                  <small id='ZmJWy'></small><noframes id='ZmJWy'>

                    <bdo id='ZmJWy'></bdo><ul id='ZmJWy'></ul>
                        1. <tfoot id='ZmJWy'></tfoot>
                        2. <legend id='ZmJWy'><style id='ZmJWy'><dir id='ZmJWy'><q id='ZmJWy'></q></dir></style></legend>
                            <tbody id='ZmJWy'></tbody>

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