loulou kikoo
E hana i kekahi mea HTML a i ʻole ʻāpana Bootstrap hiki ke kaomi ʻia e ka "kau" i kahi loulou nested ma o CSS.
E hoʻohui .stretched-link
i kahi loulou e hiki ke kaomi i kāna poloka ma o kahi mea ::after
pseudo. I ka hapanui o nā hihia, ʻo ia hoʻi, hiki ke kaomi i kahi mea me position: relative;
ka loulou me ka .stretched-link
papa. E ʻoluʻolu e hoʻomaopopo i ka hana ʻana o CSSposition
, .stretched-link
ʻaʻole hiki ke hoʻohui ʻia me ka hapa nui o nā mea papa.
Loaʻa nā kāleka position: relative
ma Bootstrap, no laila hiki iā ʻoe ke hoʻohui i ka .stretched-link
papa i kahi loulou i ke kāleka me ka ʻole o nā hoʻololi HTML ʻē aʻe.
ʻAʻole ʻōlelo ʻia nā loulou he nui a me ka paʻi ʻana me nā loulou kikoo. Eia naʻe, hiki i kekahi position
a me z-index
nā ʻano ke kōkua inā pono kēia.
Kāleka me ka loulou lohi
ʻO kekahi laʻana kikokikona wikiwiki e kūkulu ma luna o ke poʻo inoa kāleka a hoʻonui i ka nui o ka ʻike o ke kāleka.
Hele i kahi<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>
ʻAʻole loaʻa ka hapa nui o nā ʻāpana maʻamau position: relative
, no laila pono mākou e hoʻohui i .position-relative
kēia e pale aku i ka loulou mai waho o ka mea makua.
Mea hana maʻamau me ka loulou kikoo
ʻO kēia kekahi maʻiʻo placeholder no ka mea maʻamau. Manaʻo ia e hoʻohālike i ke ʻano o kekahi ʻike honua maoli, a ke hoʻohana nei mākou iā ia ma aneʻi e hāʻawi i ka ʻāpana i kahi kino a me ka nui.
Hele i kahi<div class="d-flex position-relative">
<img src="..." class="flex-shrink-0 me-3" alt="...">
<div>
<h5 class="mt-0">Custom component with stretched link</h5>
<p>This is some placeholder content for the 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>
Nā kolamu me ka loulou kikoo
ʻO kekahi laʻana o ka maʻiʻo placeholder no kēia mea maʻamau. Manaʻo ia e hoʻohālike i ke ʻano o kekahi ʻike honua maoli, a ke hoʻohana nei mākou iā ia ma aneʻi e hāʻawi i ka ʻāpana i kahi kino a me ka nui.
Hele i kahi<div class="row g-0 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 p-4 ps-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>
ʻIke ʻana i ka poloka i loaʻa
Inā ʻaʻole e holo ka loulou, ʻo ia paha ke kumu. E hoʻolilo ʻia nā waiwai CSS ma lalo nei i kahi mea i loko o ka poloka:
- He
position
waiwai ʻē aʻestatic
- A i
transform
ʻoleperspective
ka waiwai ʻē aʻenone
- He
will-change
waiwai o a itransform
oleperspective
- He
filter
waiwai ʻē aʻenone
a i ʻole hewill-change
waiwai ofilter
(hana wale nō ma Firefox)
Kāleka me nā loulou kikoo
ʻO kekahi laʻana kikokikona wikiwiki e kūkulu ma luna o ke poʻo inoa kāleka a hoʻonui i ka nui o ka ʻike o ke kāleka.
ʻAʻole e hana ʻia ka loulou ʻōlima ma ʻaneʻi, no ka mea position: relative
ua hoʻohui ʻia i ka loulou
E hohola wale ʻia kēia loulou ma luna o ka p
-tag, no ka mea, hoʻohana ʻia kahi hoʻololi iā ia.
<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>