简体   繁体   English

我如何才能使字体很棒,可以占用其父容器的整个区域

[英]How can I make the font-awesome can take the full area of its parent container

As you can see the thumbs are over its parent area. 如您所见,大拇指位于其父区域上方。 The UI layout is not acceptable. UI布局不可接受。

inline

The following is the expected result. 以下是预期的结果。 I tried to put margin-bottom with a negative number, Or tried to make them in FLEX layout. 我试图将负数放在底边,或者尝试使它们处于FLEX布局中。 None of them works. 它们都不起作用。 Any ideas? 有任何想法吗?

inline

Parent container 父容器

#vote-buttons-section .iconic-button#upvote {
  background: #7f7f7f !important;
  width: 75px;
  height: 55px; }
#vote-buttons-section .iconic-button#downvote {
  background: #7f7f7f;
  height: 55px;
  width: 75px; }

Font-awesome icons appear on the BEFORE attribute 字体真棒图标出现在BEFORE属性上

.ui-button.iconic-button.iconic-button-upvote:before,
.ui-button.iconic-button.iconic-button-upvote.ui-state-hover:before,
.ui-button.iconic-button.iconic-button-upvote.ui-state-focus:before {
  font-family: FontAwesome;
  content: "\f087";
  font-size: 55px;
  color: white;
  vertical-align: middle;
  line-height: 55px;
  }

.ui-button.iconic-button.iconic-button-downvote:before,
.ui-button.iconic-button.iconic-button-downvote.ui-state-hover:before,
.ui-button.iconic-button.iconic-button-downvote.ui-state-focus:before {
  font-family: FontAwesome;
  content: "\f088";
  font-size: 64px;
  color: white;
  vertical-align: middle; }

Seems like the heights of the containers are 55px . 好像容器的高度是55px What you can do is to add the rule line-height: 55px; 您可以做的是添加规则line-height: 55px; to the part that's handling the icons. 到处理图标的部分。 It seems like you should add it to the selectors 似乎您应该将其添加到选择器中

.ui-button.iconic-button.iconic-button-upvote:before,
.ui-button.iconic-button.iconic-button-upvote.ui-state-hover:before,
.ui-button.iconic-button.iconic-button-upvote.ui-state-focus:before

Then it should be centered. 然后,它应该居中。 You can adjust the font-size if you want, as long as the line-height is correct, it will be centered. 您可以根据需要调整font-size ,只要line-height正确,它就会居中。

What I would do, is to add the height: inherit; 我要做的就是增加height: inherit; and some padding like this: 和一些这样的padding

#vote-buttons-section .iconic-button#upvote {
   height: inherit;
   padding: 10px 10px;
}

If it doesn't work, add the !important to the CSS properties, like this: 如果不起作用,请在CSS属性中添加!important ,如下所示:

#vote-buttons-section .iconic-button#upvote {
   height: inherit !important;
   padding: 10px 10px !important;
}

Hope this helps. 希望这可以帮助。

EDIT: I didn't see that you solved the problem by a user that gave the answer before me. 编辑:我没有看到您通过在我之前给出答案的用户解决了问题。 I'm glad that you fixed your issue with user Gustaf Gunér . 很高兴您解决了用户GustafGunér的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM