css - 链接与其附加到 [中间人] css html 的图像分离

标签 css html sass middleman

所以我有一个关于图标,上面有一个链接。

<%= link_to image_tag("infobutton_circle_blue.png") ,"http://redbullrecords.com/artist/awolnation/", :id => "about" %>

这将产生这个:

<a id="about" href="http://redbullrecords.com/artist/awolnation/" style="
    height: 40px;
"><img src="/images/infobutton_circle_blue.png"></a>

在我添加任何样式之前,...图像链接出现问题。

但是一旦我添加了一些位置/尺寸样式

        #about 
          img
            float: right
            width: 50px
            padding-right: 45px

            +rhythm(-2.0 , 0, 0, 0)

然后图像不再有链接,..检查员说链接在页面的另一边,大小为 0px x 0px..很奇怪

如果有人遇到过这个问题,很想听听您是如何修复它的,以及我究竟做错了什么

我试图只定位没有 img 的图像 ID,..但它没有让步..所以这就是为什么我使用 #about img

最佳答案

我注意到我希望图标所在的空间在技术上会位于另一个元素之上,..所以我将样式更改为绝对定位并且一切正常,..仍然很奇怪

#about 
  img
    position: absolute
    width: 50px
    padding-right: 45px
    margin-left: 70%

    +rhythm(-2.0 , 0, 0, 0)

关于css - 链接与其附加到 [中间人] css html 的图像分离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30051432/

相关文章:

html - Chrome 中的文件上传样式

css - SASS - CSS - 动画在 chrome 中有效,在 firefox 中无效

javascript - 媒体查询加javascript窗口调整不同宽度

html - CSS 位置转换和显示 :none

html - CSS - 中心位置在具有绝对位置的 IE 中不起作用

css - polymer 和共享样式。在整个元素中使用 font-awesome 这样的字体

html - 为什么我的 HTML5 矩形看起来放大了?

javascript - 我创建了一个 jQuery 幻灯片,但它不断重复相同的图像

css - 编译 SCSS 文件

css - susy列和断点列表乱序?