मुख्य विषयवस्तु में जाएं डॉक्स नेविगेशन पर जाएं
in English

फैला हुआ लिंक

CSS के माध्यम से एक नेस्टेड लिंक को "स्ट्रेच" करके किसी भी HTML तत्व या बूटस्ट्रैप घटक को क्लिक करने योग्य बनाएं।

एक छद्म तत्व के माध्यम से इसके युक्त ब्लॉक.stretched-link को क्लिक करने योग्य बनाने के लिए एक लिंक में जोड़ें । ज्यादातर मामलों में, इसका मतलब यह है कि जिस तत्व में वर्ग के साथ एक लिंक होता है वह क्लिक करने योग्य होता है। कृपया ध्यान दें कि CSS कैसे काम करता है , इसे अधिकांश तालिका तत्वों के साथ मिश्रित नहीं किया जा सकता है।::afterposition: relative;.stretched-linkposition.stretched-link

कार्ड position: relativeबूटस्ट्रैप में डिफ़ॉल्ट रूप से होते हैं, इसलिए इस मामले में आप .stretched-linkबिना किसी अन्य HTML परिवर्तन के कार्ड के लिंक में कक्षा को सुरक्षित रूप से जोड़ सकते हैं।

विस्तृत लिंक के साथ एकाधिक लिंक और टैप लक्ष्य अनुशंसित नहीं हैं। हालाँकि, कुछ positionऔर z-indexशैलियाँ इसकी आवश्यकता होने पर मदद कर सकती हैं।

Card image cap
स्ट्रेच्ड लिंक वाला कार्ड

कार्ड के शीर्षक पर निर्माण करने और कार्ड की सामग्री का बड़ा हिस्सा बनाने के लिए कुछ त्वरित उदाहरण टेक्स्ट।

कही चले जाओ
<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>

अधिकांश कस्टम घटकों में डिफ़ॉल्ट रूप से नहीं होता है, इसलिए लिंक को मूल तत्व के बाहर फैलने से रोकने के लिए position: relativeहमें यहां जोड़ने की आवश्यकता है ।.position-relative

Generic placeholder image
विस्तारित लिंक के साथ कस्टम घटक

यह कस्टम घटक के लिए कुछ प्लेसहोल्डर सामग्री है। यह नकल करने का इरादा है कि कुछ वास्तविक दुनिया की सामग्री कैसी दिखेगी, और हम इसका उपयोग यहां घटक को थोड़ा सा आकार और आकार देने के लिए कर रहे हैं।

कही चले जाओ
<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
स्ट्रेच्ड लिंक वाले कॉलम

इस अन्य कस्टम घटक के लिए प्लेसहोल्डर सामग्री का एक और उदाहरण। यह नकल करने का इरादा है कि कुछ वास्तविक दुनिया की सामग्री कैसी दिखेगी, और हम इसका उपयोग यहां घटक को थोड़ा सा आकार और आकार देने के लिए कर रहे हैं।

कही चले जाओ
<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>

युक्त ब्लॉक की पहचान करना

यदि फैला हुआ लिंक काम नहीं करता है, तो संभवत : इसका कारण होगा। निम्नलिखित सीएसएस गुण तत्व को युक्त ब्लॉक बना देंगे:

  • के अलावा एक positionमूल्यstatic
  • A transformया perspectiveके अलावा अन्य मानnone
  • or . का will-changeमानtransformperspective
  • filterइसके अलावा एक मूल्य noneया इसके will-changeमूल्य filter(केवल फ़ायरफ़ॉक्स पर काम करता है)
Card image cap
स्ट्रेच्ड लिंक्स वाला कार्ड

कार्ड के शीर्षक पर निर्माण करने और कार्ड की सामग्री का बड़ा हिस्सा बनाने के लिए कुछ त्वरित उदाहरण टेक्स्ट।

स्ट्रेच्ड लिंक यहां काम नहीं करेगा, क्योंकि position: relativeलिंक में जोड़ा जाता है

यह फैला हुआ लिंक केवल p-टैग पर ही फैलाया जाएगा, क्योंकि इस पर एक रूपांतरण लागू होता है।

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