【问题标题】:Inserting a link插入链接
【发布时间】:2017-04-07 20:55:18
【问题描述】:

如何将 facebook 字体真棒图标变成链接?每当我插入链接时,它都会将图标推出图片框架。我也想将其他社交媒体图标放在 facebook 图标旁边,但目前我只是想解决让图标链接到 facebook 的问题。

CSS

.polaroid-images a {
 background: white;
 display: inline;
 float: left;
 margin: 0 15px 70px;
 padding: 10px 10px 25px;
 text-align: center;
 text-decoration: none;
 -webkit-box-shadow: 0 4px 6px rgba(0, 0, 0, .3);
 -moz-box-shadow: 0 4px 6px rgba(0, 0, 0, .3);
 box-shadow: 0 4px 6px rgba(0, 0, 0, .3);
 -webkit-transition: all .15s linear;
 -moz-transition: all .15s linear;
 transition: all .15s linear;
 z-index: 0;
 position: relative;
}

.polaroid-images a,
 :after {
 color: #333;
 font-size: 20px;
 content: attr(title);
 position: relative;
 top: 15px;
}

.polaroid-images img {
  display: block;
  width: inherit;
}

.polaroid-images a,
 i:nth-child(3n) {
 -webkit-transform: rotate(-24deg);
 -moz-transform: rotate(-24deg);
 transform: rotate(-24deg);
}

.polaroid-images a:hover {
 -webkit-transform: rotate(0deg);
 -moz-transform: rotate(0deg);
 transform: rotate(0deg);
 -webkit-transform: scale(1.2);
 -moz-transform: scale(1.2);
 transform: scale(1.2);
 z-index: 10;
 -webkit-box-shadow: 0 10px 20px rgba(0, 0, 0, .7);
 -moz-box-shadow: 0 10px 20px rgba(0, 0, 0, .7);
 box-shadow: 0 10px 20px rgba(0, 0, 0, .7);
}

.polaroid-images i {
 position: relative;
 font-size: 1em;
 top: 15px;
 margin-right: .5em;
 color: #3b5998;
}

HTML

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-
awesome.min.css" rel="stylesheet"/>

<div class="polaroid-images">
  <a href="" title="Alex"><img height="200" 
   src="http://kenwheeler.github.io/slick/img/fonz1.png" alt="Island" 
  title="Alex" class=fishes /><i class="fa fa-facebook fa-3x"></i></a>
</div>

【问题讨论】:

  • 请添加一些相关代码。
  • 你的 HTML 在哪里?
  • 它的间距不合适所以被剪掉了,我刚刚编辑了它。

标签: html css


【解决方案1】:

所以,到目前为止,您有一个链接可以包装您的整张卡片。除非您希望整张卡片链接到 Facebook,否则您可能应该删除它。这是我要做的:

.polaroid-images div {
 background: white;
 display: inline;
 float: left;
 margin: 0 15px 70px;
 padding: 10px 10px 25px;
 text-align: center;
 text-decoration: none;
 -webkit-box-shadow: 0 4px 6px rgba(0, 0, 0, .3);
 -moz-box-shadow: 0 4px 6px rgba(0, 0, 0, .3);
 box-shadow: 0 4px 6px rgba(0, 0, 0, .3);
 -webkit-transition: all .15s linear;
 -moz-transition: all .15s linear;
 transition: all .15s linear;
 z-index: 0;
 position: relative;
}

.polaroid-images div,
 :after {
 color: #333;
 font-size: 20px;
 content: attr(title);
 position: relative;
 top: 15px;
}

.polaroid-images img {
  display: block;
  width: inherit;
}

.polaroid-images div,
 i:nth-child(3n) {
 -webkit-transform: rotate(-24deg);
 -moz-transform: rotate(-24deg);
 transform: rotate(-24deg);
}

.polaroid-images div:hover {
 -webkit-transform: rotate(0deg);
 -moz-transform: rotate(0deg);
 transform: rotate(0deg);
 -webkit-transform: scale(1.2);
 -moz-transform: scale(1.2);
 transform: scale(1.2);
 z-index: 10;
 -webkit-box-shadow: 0 10px 20px rgba(0, 0, 0, .7);
 -moz-box-shadow: 0 10px 20px rgba(0, 0, 0, .7);
 box-shadow: 0 10px 20px rgba(0, 0, 0, .7);
}

.polaroid-images i {
 position: relative;
 font-size: 1em;
 top: 15px;
 margin-right: .5em;
 color: #3b5998;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-
awesome.min.css" rel="stylesheet"/>

<div class="polaroid-images">
  <div title="Alex">
    <img height="200" 
   src="http://kenwheeler.github.io/slick/img/fonz1.png" alt="Island" 
  title="Alex" class=fishes />
    
    <a href="https://www.facebook.com/"><i class="fa fa-facebook fa-3x"></i></a>
  </div>
</div>

基本上,我只是从整个块中删除了a 标签,并且只将它包裹在四个 FB 图标周围。然后我将您的容器更改为 div 并相应更改样式。

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 2015-10-16
    • 1970-01-01
    • 2010-09-14
    • 2011-09-22
    • 2019-11-15
    • 2013-09-26
    • 2017-08-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多