Source

So'oga fa'aloloa

Faia so'o se elemene HTML po'o se vaega Bootstrap e mafai ona kiliki e ala i le "fa'aloaloa" se feso'ota'iga e ala i le CSS.

Fa'aopoopo .stretched-linki se feso'ota'iga ina ia mafai ona kiliki le poloka o lo'o i ai e ala i se ::afterelemene fa'afoliga. I le tele o tulaga, o lona uiga o se elemene position: relative;o loʻo i ai se sootaga ma le .stretched-linkvasega e mafai ona kiliki.

O kata position: relativee le mafai ona faʻaogaina i Bootstrap, o lea i lenei tulaga e mafai ona e faʻapipiʻi saogalemu le .stretched-linkvasega i se fesoʻotaʻiga i le kata e aunoa ma se isi suiga HTML.

E le fautuaina le tele o feso'ota'iga ma ta'i fa'atasi ma so'otaga fa'aloloa. Ae ui i lea, o nisi positionma z-indexsitaili e mafai ona fesoasoani pe a manaʻomia lenei mea.

Card image cap
Kata o lo'o iai so'otaga fa'aloloa

O nisi fa'ata'ita'iga vave o tusitusiga e fau i luga o le igoa kata ma fa'atupuina le tele o mea o lo'o i totonu o le kata.

Alu i se mea
<div class="card" style="width: 18rem;">
  <img src="..." class="card-img-top" alt="...">
  <div class="card-body">
    <h5 class="card-title">Card with stretched link</h5>
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <a href="#" class="btn btn-primary stretched-link">Go somewhere</a>
  </div>
</div>

O mea fa'asalalau e leai ni position: relativefa'aletonu, o lea e mana'omia ai le fa'aopoopo .position-relativei'i e taofia ai le so'otaga mai le fa'aloloa i fafo o le mea fa'asalalau.

Generic placeholder image
Ala fa'asalalau fa'atasi ma so'otaga fa'aloloa

Cras sat amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum i vulputate ma, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis i faucibus.

Alu i se mea
<div class="media position-relative">
  <img src="..." class="mr-3" alt="...">
  <div class="media-body">
    <h5 class="mt-0">Media with stretched link</h5>
    <p>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.</p>
    <a href="#" class="stretched-link">Go somewhere</a>
  </div>
</div>

O koluma position: relativee le mafai, o lea e na'o koluma e mafai ona kiliki e mana'omia ai le .stretched-linkvasega i luga o se so'oga. Ae ui i lea, o le faʻalauteleina o se soʻotaga i luga o le atoa .rowe manaʻomia .position-staticile koluma ma .position-relativeluga ole laina.

Generic placeholder image
Koluma o lo'o iai so'oga fa'aloloa

Cras sat amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum i vulputate ma, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis i faucibus.

Alu i se mea
<div class="row no-gutters bg-light position-relative">
  <div class="col-md-6 mb-md-0 p-md-4">
    <img src="..." class="w-100" alt="...">
  </div>
  <div class="col-md-6 position-static p-4 pl-md-0">
    <h5 class="mt-0">Columns with stretched link</h5>
    <p>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.</p>
    <a href="#" class="stretched-link">Go somewhere</a>
  </div>
</div>

Fa'ailoaina le poloka o lo'o i ai

Afai e foliga mai e le aoga le so'otaga fa'aloloa , atonu o le poloka o lo'o i ai le mafua'aga. O mea nei CSS o le a avea ai se elemene ma poloka poloka:

  • O se positiontau e ese maistatic
  • A transformpo'o perspectivele tau e ese mainone
  • O se will-changetaua o transformpeperspective
  • O se filtertau e ese mai nonepo'o se will-changetau o filter(na'o Firefox e galue)
Card image cap
Kata o lo'o iai so'otaga fa'aloloa

O nisi fa'ata'ita'iga vave o tusitusiga e fau i luga o le igoa kata ma fa'atupuina le tele o mea o lo'o i totonu o le kata.

O le a le aoga le so'oga fa'alolo iinei, aua position: relativeua fa'aopoopo i le so'oga

O lenei so'oga fa'aloloa o le a na'o le fa'asalalauina i luga o le p-tag, ona o se suiga e fa'atatau i ai.

<div class="card" style="width: 18rem;">
  <img src="..." class="card-img-top" alt="...">
  <div class="card-body">
    <h5 class="card-title">Card with stretched links</h5>
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <p class="card-text">
      <a href="#" class="stretched-link text-danger" style="position: relative;">Stretched link will not work here, because <code>position: relative</code> is added to the link</a>
    </p>
    <p class="card-text bg-light" style="transform: rotate(0);">
      This <a href="#" class="text-warning stretched-link">stretched link</a> will only be spread over the <code>p</code>-tag, because a transform is applied to it.
    </p>
  </div>
</div>