Vra

Hoe om meer as 2 ikone in Font Awesome te stapel/oorvleuel?

Ek het daarin geslaag om 2 ikone soos hierdie te stapel/oorvleuel.

<span class="fa-stack fa-lg">
  <i class="fa fa-square-o fa-stack-2x"></i>
  <i class="fa fa-twitter fa-stack-1x"></i>
</span>

http://jsfiddle.net/nplwz/Verw: http://fontawesome.io/examples/#stacked

Maar as ek probeer om 3 of meer ikone soos hierdie te stapel/oorvleuel.

<span class="fa-stack fa-3x">
  <i class="fa fa-square-o fa-stack-3x"></i>
  <i class="fa fa-square-o fa-stack-2x"></i>
  <i class="fa fa-square-o fa-stack-1x"></i>
</span>

http://jsfiddle.net/nplwz/1/

Dit raak deurmekaar, enige idee, hoe kan ek dit regstel? en kry 3 of meer ikone op mekaar opgestapel/oorvleuel.

Was dit nuttig?

Oplossing

Ek het 'n soortgelyke probleem gehad en opgelos met behulp van 'n paar persoonlike CSS.

.icon-stack {
  position: relative;
  display: inline-block;
  width: 2em;
  height: 2em;
  line-height: 2em;
  vertical-align: middle;
}
.icon-stack-1x,
.icon-stack-2x,
.icon-stack-3x {
  position: absolute;
  left: 0;
  width: 100%;
  text-align: center;
}
.icon-stack-1x {
  line-height: inherit;
}
.icon-stack-2x {
  font-size: 1.5em;
}
.icon-stack-3x {
  font-size: 2em;
}

Opmerking is dus:

<span class="icon-stack fa-3x">
   <i class="fa fa-{{whatever icon 3}} icon-stack-3x"></i>
   <i class="fa fa-{{whatever icon 2}} icon-stack-2x"></i>
   <i class="fa fa-{{whatever icon 1}} icon-stack-1x"></i>
</span>

Ek het besluit eerder as om die FA-Stack te oorheers, sou ek dupliseer, sodat ek steeds die oorspronklike CSS kan gebruik indien nodig.

U kan natuurlik rondspeel met die lettergrootte, lynhoogte ens om aan u eie vereistes te voldoen.

Ander wenke

Uiteindelik 'n nuwe funksie van Lettertipe is vrygestel en nou kan u meer as 2 ikone stapel:

Kyk na die volgende skakel: https://fontawesome.com/how-to-use/on-the-web/styling/layering

Hierdie funksie word tans verskaf deur lettertipe.

Sien: https://fontawesome.com/how-to-use/on-the-web/styling/stack-icons

Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow
scroll top