CSS Bootstrap : 在缩略图的右下角添加按钮链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17167833/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 23:15:22  来源:igfitidea点击:

Bootstrap : Add a button link in the bottom right corner of a thumbnail

csstwitter-bootstrapthumbnails

提问by user2178964

I want to do something like that :

我想做这样的事情:

enter image description here

在此处输入图片说明

For now, I'm using margin but I'm sure there is some "clean" method to do that... : http://jsfiddle.net/vXMMA/445/

现在,我正在使用边距,但我确信有一些“干净”的方法可以做到这一点......:http: //jsfiddle.net/vXMMA/445/

<ul class="media-grid">
  <li>
    <a href="#">
        <img class="thumbnail" src="http://placehold.it/140x90" alt=""/>
    </a>
    <a href="#" class="btn" style="margin-left:-23px;margin-top:67px;">+</a>
  </li> 
  <li>
    <a href="#">
        <img class="thumbnail" src="http://placehold.it/140x90" alt=""/>
    </a>
    <a href="#" class="btn" style="margin-left:-23px;margin-top:67px;">+</a>
  </li>       

</ul>

回答by M.G.Manikandan

How about this

这个怎么样

<ul class="media-grid">
  <li>
    <a href="#" style="position:relative;">
        <img class="thumbnail" src="http://placehold.it/140x90" alt=""/>
        <button class="btn" style="position:absolute;bottom:5px;right:5px;margin:0;padding:5px 3px;">+</button>
    </a>
  </li> 
  <li>
    <a href="#" style="position:relative;">
        <img class="thumbnail" src="http://placehold.it/140x90" alt=""/>
        <button class="btn" style="position:absolute;bottom:5px;right:5px;margin:0;padding:5px 3px;">+</button>
      </a>
  </li>
</ul>

http://jsfiddle.net/xKrXn/1/

http://jsfiddle.net/xKrXn/1/

回答by hmhcreative

try this one:

试试这个:

ul.media-grid li {
  position: relative;
  display: inline-block;
}

.btn {
  position: absolute;
  bottom: 10px;
  right: 6px;
}

.media-grid a {
  float: none;
  display: inline-block;
}

http://jsfiddle.net/vXMMA/446/

http://jsfiddle.net/vXMMA/446/