Rach gu prìomh shusbaint Air adhart gu seòladh docs
Check
in English

Ceangal sìnte

Dèan cliogadh air eileamaid HTML no co-phàirt Bootstrap le bhith “a’ sìneadh ”ceangal neadachaidh tro CSS.

Cuir .stretched-linkri ceangal gus am bi am bloc anns a bheil e comasach cliogadh tro ::aftereileamaid bhrèige. Anns a’ mhòr-chuid de chùisean, tha seo a’ ciallachadh gum faodar cliogadh air eileamaid leis position: relative;a bheil ceangal ris a’ .stretched-linkchlas. Thoir an aire leis mar a tha CSS positionag obair , .stretched-linkchan urrainnear a mheasgachadh leis a’ mhòr-chuid de eileamaidean bùird.

Tha cairtean position: relativeann am Bootstrap gu bunaiteach, agus mar sin anns a’ chùis seo faodaidh tu an .stretched-linkclas a chuir gu ceangal sa chairt gu sàbhailte gun atharrachadh HTML sam bith eile.

Chan eilear a’ moladh ioma-cheanglaichean agus targaidean tap le ceanglaichean sìnte. Ach, faodaidh cuid positionagus z-indexstoidhlichean cuideachadh ma bhios feum air.

Card image cap
Cairt le ceangal sìnte

Cuid de theacs eisimpleir sgiobalta gus togail air tiotal na cairt agus a’ mhòr-chuid de shusbaint na cairt a dhèanamh.

Rach àiteigin
html
<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>

Chan eil a’ mhòr-chuid de cho-phàirtean gnàthaichte position: relativemar as àbhaist, agus mar sin feumaidh sinn an .position-relativeseo a chuir ris gus casg a chuir air a’ cheangal bho bhith a’ sìneadh taobh a-muigh na h-eileamaid phàrant.

Generic placeholder image
Co-phàirt gnàthaichte le ceangal sìnte

Is e seo cuid de shusbaint neach-àite airson a’ phàirt àbhaisteach. Thathas an dùil a bhith ag atharrais cò ris a bhiodh susbaint fìor san t-saoghal coltach, agus tha sinn ga chleachdadh an seo gus beagan bodhaig is meud a thoirt don phàirt.

Rach àiteigin
html
<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>
Generic placeholder image
Colbhan le ceangal sìnte

Eisimpleir eile de shusbaint neach-àite airson a’ phàirt àbhaisteach eile seo. Thathas an dùil a bhith ag atharrais cò ris a bhiodh susbaint fìor san t-saoghal coltach, agus tha sinn ga chleachdadh an seo gus beagan bodhaig is meud a thoirt don phàirt.

Rach àiteigin
html
<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>

A 'comharrachadh a' bhloc anns a bheil

Mura h-eil coltas gu bheil an ceangal sìnte ag obair, is dòcha gur e am bloc anns a bheil e as coireach. Nì na feartan CSS a leanas eileamaid anns a’ bhloc anns a bheil:

  • Luach positioneile seachstatic
  • A transformno perspectiveluach a bharrachd airnone
  • Tha will-changeluach transformorperspective
  • filterLuach eile seach noneno will-changeluach filter(ag obair air Firefox a-mhàin )
Card image cap
Cairt le ceanglaichean sìnte

Cuid de theacs eisimpleir sgiobalta gus togail air tiotal na cairt agus a’ mhòr-chuid de shusbaint na cairt a dhèanamh.

Chan obraich ceangal sìnte an seo, oir position: relativetha e air a chur ris a’ cheangal

Cha tèid an ceangal sìnte seo a sgaoileadh ach thairis air an p-tag, leis gu bheil cruth-atharrachaidh ga chur an sàs.

html
<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>