【发布时间】:2019-02-07 02:49:25
【问题描述】:
我已将社交媒体图标作为“跟我来” 部分放在我的页脚中。现在我想在https://www.w3schools.com/css/tryit.asp?filename=trycss_tooltip_arrow_bottom 有一个像这样的工具提示,其中每个都会弹出一个文本“facebook”、“Twitter”等。
由于我不想在尝试此操作时弄乱我的页脚和社交媒体图标,因此我如何利用已有的实现这一目标。有没有办法把<span class="tooltiptext"> 挤进去?或者将其用作 id 标签?例如,我正在考虑尝试这样的事情。
<a href="#" class="fa fa-facebook" id="tooltiptext"></a>
这可能吗?
任何提示和技巧将不胜感激。 随意运行代码 sn-p 看看我的社交媒体图标现在是什么样子。
/* Footer aka a copyright + social media pages */
.footer {
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
/* Height of the footer */
background-color: #b3b3ff;
}
.tooltip .tooltiptext {
width: 120px;
bottom: 100%;
left: 50%;
margin-left: -60px;
/* Use half of the width (120/2 = 60), to center the tooltip */
}
.fa {
padding: 20px;
font-size: 30px;
width: 50px;
text-align: center;
text-decoration: none;
margin: 5px 2px;
border-radius: 50%;
}
.fa:hover {
opacity: 0.7;
}
.fa-facebook {
background: #3B5998;
color: white;
}
.fa-twitter {
background: #55ACEE;
color: white;
}
.fa-linkedin {
background: #007bb5;
color: white;
}
.fa-instagram {
background: #125688;
color: white;
}
.fa-snapchat {
background: #fffc00;
color: white;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="footer">
<div class="tooltip">
<!-- Now where should I place "tooltiptext" -->
<a href="#" class="fa fa-facebook"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-linkedin"></a>
<a href="#" class="fa fa-instagram"></a>
<a href="#" class="fa fa-snapchat"></a>
</div>
</div>
【问题讨论】:
标签: html css tooltip font-awesome cloudflare