Wordpress顶部面板上的浮动社会图标

时间:2017-10-17 05:16:16

标签: html css wordpress css3

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

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

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>

有人可以告诉我为什么这两个图标都在彼此之上以及为什么这不起作用?

2 个答案:

答案 0 :(得分:3)

试试这个,从#socialiconwrapper中移除填充和上边距。

#socialiconwrapper {
    width: 100px;
    height: 100px;
    padding: 0px;
    z-index: 999;
    margin-top: 0px;
}

.social {
   float: right;
   height: 36px;
   width: 36px;
}

答案 1 :(得分: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;
}