html - 向 .img-circle Bootstrap 元素添加悬停功能

标签 html css image twitter-bootstrap

您好,我一直在努力尝试从 Bootstrap 模板向 .img-circle 元素添加悬停功能。理想情况下,我希望圆形图像稍微变暗,以便您可以单击弹出窗口(已经编码)

这是我的 HTML。我一直无法找到有效的悬停解决方案的 CSS。

        <div class="col-lg-4 col-sm-6 text-center">
               <img class="img-circle" src="http://placehold.it/200x200" alt="" a href="javascript:void(0)" onclick="toggle_visibility('popup-box1');">
            <a href="javascript:void(0)" onclick="toggle_visibility('popup-box1');"><h3>Serge</h3></a>
           <h4>Deal sourcing and pricing </h4>
        </div>

        <div class="col-lg-4 col-sm-6 text-center">
            <img class="img-circle" src="http://placehold.it/200x200" alt="" a href="javascript:void(0)" 
                 onclick="toggle_visibility('popup-box2');">
            <a href="javascript:void(0)" onclick="toggle_visibility('popup-box2');"><h3>Ed</h3></a>
               <h4>Private wealth &amp; HNWI liason </h4>

        </div>

        <div class="col-lg-4 col-sm-6 text-center">
            <img class="img-circle" src="http://placehold.it/200x200" alt="" a href="javascript:void(0)" 
                 onclick="toggle_visibility('popup-box3');">
           <a href="javascript:void(0)" onclick="toggle_visibility('popup-box3');"><h3>Mayank Gupta</h3></a>
                 <h4>Deal structuring &amp; compliance </h4>

        </div>

这是我的 fiddle https://jsfiddle.net/7z1caucd/当我将光标悬停在上面时,只希望 200x200 图像变暗。无法在 CSS 中解决。请帮忙。

最佳答案

尝试将 :hover 放在 img 标签以外的地方。例如将它包装在 div 中并将类放在那里。

<div class="img-circle"><img src="http://placehold.it/200x200" /></div>

对于CSS:

.img-circle:hover{
    opacity: 0.5;
}

关于html - 向 .img-circle Bootstrap 元素添加悬停功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37554199/

相关文章:

javascript - 如何阻止按钮上的动画影响按钮的悬停或一般功能

html - 雅虎问答真的是 "Infinite Scroll"页面吗? Python

css - Chrome -webkit-clip-path 和大纲错误

css - 我如何在 material-ui 中使用伪元素::之前,::之后

image - JavaFX 2.2 图像支持 .ico?

python - Python 中的 PIL 提示 PixelAccess 没有 'size' 属性,我做错了什么?

javascript - 将表单的文件输入字段的值复制到另一个表单的输入字段

c# - C#软件包Tyrrrz/YoutubeExplode对于YouTube html5视频返回错误403,但对于Flash视频则不返回错误403

CSS3手电筒效果

c# - 从位图图像裁剪图像