当页面变小时,Font-Awesome图标会移动

问题描述 投票:0回答:1

/ * icon sect * /

.social {
  margin-top: px;
  padding: 0;
  position: absolute;
  top: 60%;
  left: 50%;
transform: translate(-50%,-50%);
}

.social li {
  list-style: none;
  float: left;
  margin: 0px;
  width: 60px;
  height: 10px;
  line-height: 60px;
  text-align: center;
  background: #;
  border-radius: 50%;
  font-size: 50px;
  position: ;
  transition: .5s ease-in-out;
  color: #004d26;
  z-index: 1;
}

.social li:before {
  content: '';
  width: 100%;
  height: 100%;
  position: ;
  top: 0;
  left: 0;
  background: #ff003b;
  border-radius: 50%;
  transform: scale(0);
  transition: .5s ease-in-out;
  z-index: -1;
}

.social li:hover:before {
  transform: scale(.9);
}

.social li:hover {
 color: #979FA8;
}

大家好。所以,我有这个问题,如果我点击并按住我的网页底部并决定拉起来,最小化屏幕,我的字体真棒图标随之移动。我希望我的图标可以保持原样,而不是移动。感谢您的帮助!如果我以某种方式重复某人的问题,我道歉。我一直无法找到解决方案。

html css twitter-bootstrap
1个回答
0
投票

欢迎使用HTML和CSS !! MDN是最好的学习场所。

这是edited code以你想要的方式工作(我相信)(不是真正理想的方式)。

我删除了元素的绝对定位。因为你只是想集中对齐我使用text-align:center的元素;

如果要将元素w.r.t固定为父元素(相对定位元素),请使用绝对定位。

改变了.social类的风格

.social {
  text-align: center;
}

并在选择器display: inline-block;下添加了float: left;instead of .social li

.social li {
  display: inline-block; 
}

快乐的编码。附:你可以使用已经构建的bootstrap模板制作关于我的页面。

© www.soinside.com 2019 - 2024. All rights reserved.