【问题标题】:Floating Social Icons on Wordpress Top panelWordPress 顶部面板上的浮动社交图标
【发布时间】:2017-10-17 05:16:16
【问题描述】:

我正在尝试在 wordpress 网站右侧的顶部面板上浮动两个 css 社交图标 facebook 和 linkedin,同时使图标具有响应性。我将两个图标都放入了一个容器中,但它似乎无法控制图标甚至无法正常工作。

您可以找到该网站,该网站的右上角有一半的图标显示一半隐藏在页面顶部蓝线的菜单栏后面。

http://www.rodgersgroupllc.com/newsite/

这是 HTML:

/* Social Icons */
#socialiconwrapper{
  width:100px;
  height:100px;
  float:right;
}
.social{
  float:right;
}

html {
  font-size: 10px;
}
body {
  text-align: right;
}
/* Wrapper */
.icon-button {
  background-color: white;
  border-radius: 7.6rem;
  cursor: pointer;
  display: inline-block;
  font-size: 2.0rem;
  height: 3.6rem;
  line-height: 3.6rem;
  margin: 0 5px;
  position: relative;
  text-align: center;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  width: 3.6rem;
  margin-left: auto;
  margin-right: auto;
  height: 30px;
}
/* Circle */
.icon-button div {
  border-radius: 0;
  display: block;
  height: 0;
  left: 50%;
  margin: 0;
  position: absolute;
  top: 50%;
  -webkit-transition: all 0.3s;
  -moz-transition: all 0.3s;
  -o-transition: all 0.3s;
  transition: all 0.3s;
  width: 0;

}
.icon-button:hover div {
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 3.6rem;
  margin: -1.8rem;
}
.twitter div {
  background-color: #4099ff;
}
.facebook div {
  background-color: #3B5998;
}
/* Icons */
.icon-button i {
  background: none;
  color: white;
  height: 3.6rem;
  left: 0;
  line-height: 3.6rem;
  position: absolute;
  top: 0;
  width: 3.6rem;
  z-index: 10;
}
.icon-button .icon-twitter {
  color: #4099ff;
}
.icon-button .icon-facebook {
  color: #3B5998;
  padding-right: 20px;
  padding-left: 20px;
}
.icon-button:hover .icon-twitter,
.icon-button:hover .icon-facebook,
<div id='socialiconwrapper'>
    <div class ='social'>
      <a href="https://twitter.com/minimalmonkey" class="icon-button twitter"><i class="icon-twitter"></i><span></span></a>
    </div>

    <div class ='social'>
      <a href="https://facebook.com" class="icon-button facebook"><i class="icon-facebook"></i><span></span></a>
    </div>
</div>

谁能告诉我为什么这两个图标都在彼此之上,为什么这不起作用?

【问题讨论】:

    标签: html wordpress css


    【解决方案1】:

    试试这个,从#socialiconwrapper 中删除内边距和上边距。

    #socialiconwrapper {
        width: 100px;
        height: 100px;
        padding: 0px;
        z-index: 999;
        margin-top: 0px;
    }
    
    .social {
       float: right;
       height: 36px;
       width: 36px;
    }
    

    【讨论】:

    • 这很好地排列了图标rodgersgroupllc.com/newsite,但图标中的动画不起作用。参见 jfiddle 例如:jsfiddle.net/X3b5g/1065 还有其他建议吗?谢谢!
    • @FrankG。悬停效果使用了这个 css .icon-button:hover i { color:white; }
    • .facebook div:hover{ border-radius: 50%; } 并删除 .icon-button .icon-facebook 左右填充和 .icon-button:hover div 高度和宽度应为 3.3rem
    【解决方案2】:

    因为.icon-button i的绝对魔药

    试试这个

    #socialiconwrapper {
      float: right;
      height: auto;
      margin: 1px 0 0;
      width: auto;
    }
    #socialiconwrapper .social {
      float: right;
      margin-left: 12px;
      text-align: center;
    }
    #socialiconwrapper .invert a {
      background-color: #fff;
      color: #f3ad45;
      float: left;
      height: 30px;
      text-align: center;
      width: 30px;
    }
    #socialiconwrapper i {
        display: inline-block;
        float: none;
        font-size: 18px;
        height: auto;
        padding: 0;
        position: relative;
        top: -2px;
        width: auto;
    }
    

    【讨论】:

    • Milan Agheda 有帮助,但现在图标没有动画了。您可以在此处查看它们的动画效果:jsfiddle.net/X3b5g/1065 现在是什么原因造成的?谢谢!!
    猜你喜欢
    • 1970-01-01
    • 2013-02-16
    • 2018-01-04
    • 2016-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-05
    • 1970-01-01
    相关资源
    最近更新 更多