简体   繁体   English

内联阻止不适用于一个元素

[英]Inline-block doesn't work on one element

I have four links on my web page's footer. 我的网页页脚有四个链接。 I've set hover style with white background color to the text links and also "display: inline-block;". 我为文本链接设置了带有白色背景色的悬停样式,并设置了“ display:inline-block;”。 When I hover on those links, they looks like this: 当我将鼠标悬停在这些链接上时,它们如下所示:

在此处输入图片说明

Inline-block doesn't always work on the Facebook link, that means that it depends on the screen size. 内联阻止并不总是在Facebook链接上起作用,这意味着它取决于屏幕尺寸。 And I can't figure out why it behaves like this. 而且我不知道为什么会这样。 I'm using Bootstrap for my work. 我正在使用Bootstrap进行工作。

This is the HTML for those 2 links: 这是这两个链接的HTML:

<div class="col-sm-3" id="addr"> <a href="https://goo.gl/maps/ny3wV" title="Asukoht" target="_blank"><img src="images/location.png" alt="asukoht" title="Asukoht"/></a> <a href="https://goo.gl/maps/ny3wV" title="Asukoht" target="_blank">
          <p>Jansuki Shop<br />
            Müürivahe 17<br />
            Tallinn </p>
          </a> </div>
        <div class="col-sm-3" id="fb"> <a href="https://www.facebook.com/8Delfiini" title="Facebook" target="_blank"><img src="images/fb.png" alt="Facebook" title="Facebook"/></a> <a href="https://www.facebook.com/8Delfiini" title="Facebook" target="_blank">
          <p>8 Delfiini Facebookis</p>
          </a> </div>

And this is the CSS: 这是CSS:

#addr p, #fb p
{
    margin: 0;
    padding: 0;
    display: inline-block;
}

#addr p:hover, #fb p:hover
{
    background-color: rgb(255,255,255);
    color: rgb(157,52,46);
    text-decoration: none;  
}

I've tried to inspect it and I see that the Facebook p tag has a wider padding or container (I don't know how to call this) than the p tag that belongs to address part. 我尝试对其进行检查,发现Facebook p标签具有比属于地址部分的p标签更宽的填充或容器(我不知道该如何称呼)。 I know I'm not supposed to post my project's link here, but if there's someone who could help me, I'd be very happy. 我知道我不应该在这里发布项目链接,但是如果有人可以帮助我,我会很高兴的。 Thank you in advance. 先感谢您。

您是否尝试过为嵌入式块设置宽度和高度?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM