Rohy mivelatra
Manaova singa HTML na singa Bootstrap azo kitihina amin'ny alàlan'ny "fanitarana" rohy misy akany amin'ny CSS.
Ampio .stretched-linkamina rohy mba hahatonga azy ho azo kitihina amin'ny alalan'ny ::aftersinga pseudo. Amin'ny ankabeazan'ny toe-javatra, midika izany fa azo kitihina ny singa iray position: relative;misy rohy miaraka amin'ny .stretched-linkkilasy. Azafady, mariho ny fomba fiasan'ny CSSposition , .stretched-linktsy azo afangaro amin'ny ankamaroan'ny singa latabatra.
Ny karatra dia manana position: relativeamin'ny alàlan'ny Bootstrap, ka amin'ity tranga ity dia azonao atao ny manampy ny .stretched-linkkilasy amin'ny rohy ao anaty karatra tsy misy fanovana HTML hafa.
Rohy maro sy kendrena tap dia tsy soso-kevitra amin'ny rohy mivelatra. Na izany aza, ny sasany positionsy ny z-indexfomba dia afaka manampy raha ilaina izany.
Karatra misy rohy mivelatra
Lahatsoratra ohatra haingana hanorina eo amin'ny lohatenin'ny karatra ary mandrafitra ny ampahany betsaka amin'ny atiny.
Mandehana any<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>
Ny zavatra media dia tsy manana position: relativeamin'ny alàlan'ny default, noho izany dia mila ampiana .position-relativeeto isika mba hisorohana ny rohy tsy hivelatra ivelan'ny zavatra media.
Media misy rohy mivelatra
Ity dia votoaty mpihazona toerana ho an'ny zavatra media. Natao haka tahaka ny endriky ny votoaty tena izy io, ary ampiasainay eto mba hanomezana vatana sy habeny kely ilay singa.
Mandehana any<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>This is some placeholder content for the media object. It is intended to mimic what some real-world content would look like, and we're using it here to give the component a bit of body and size.</p>
<a href="#" class="stretched-link">Go somewhere</a>
</div>
</div>
Ny tsanganana dia position: relativeamin'ny alàlan'ny default, ka ny tsanganana azo kitihina ihany no mila ny .stretched-linkkilasy amin'ny rohy. Na izany aza, ny fanitarana rohy iray manontolo .rowdia mitaky .position-staticeo amin'ny tsanganana sy .position-relativeeo amin'ny laharana.
Tsanganana misy rohy mivelatra
Ohatra iray hafa momba ny votoatin'ny placeholder ho an'ity singa mahazatra hafa ity. Natao haka tahaka ny endriky ny votoaty tena izy io, ary ampiasainay eto mba hanomezana vatana sy habeny kely ilay singa.
Mandehana any<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>Another instance of placeholder content for this other custom component. It is intended to mimic what some real-world content would look like, and we're using it here to give the component a bit of body and size.</p>
<a href="#" class="stretched-link">Go somewhere</a>
</div>
</div>
Famantarana ny sakana misy
Raha toa ka tsy mandeha ilay rohy mivelatra dia ilay sakana misy azy no mety ho antony. Ireto fananana CSS manaraka ireto dia hahatonga singa iray ho sakana misy:
- Sanda
positionhafa ankoatra nystatic - A
transformnaperspectivesanda hafa ankoatra nynone - Ny
will-changesandan'nytransformorperspective filterSanda hafa ankoatra nynonesandan'nywill-change(filtermiasa amin'ny Firefox ihany)
Karatra misy rohy mivelatra
Lahatsoratra ohatra haingana hanorina eo amin'ny lohatenin'ny karatra ary mandrafitra ny ampahany betsaka amin'ny atiny.
Ny rohy mivelatra dia tsy mandeha eto, satria position: relativeampiana amin'ny rohy
Ity rohy mivelatra ity dia hiparitaka amin'ny p-tag ihany, satria misy fiovana ampiharina aminy.
<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>