फैला हुआ लिंक
CSS के माध्यम से एक नेस्टेड लिंक को "स्ट्रेच" करके किसी भी HTML तत्व या बूटस्ट्रैप घटक को क्लिक करने योग्य बनाएं।
एक छद्म तत्व के माध्यम से इसके युक्त ब्लॉक.stretched-link
को क्लिक करने योग्य बनाने के लिए एक लिंक में जोड़ें । ज्यादातर मामलों में, इसका मतलब यह है कि जिस तत्व में वर्ग के साथ एक लिंक होता है वह क्लिक करने योग्य होता है।::after
position: relative;
.stretched-link
कार्ड position: relative
बूटस्ट्रैप में डिफ़ॉल्ट रूप से होते हैं, इसलिए इस मामले में आप .stretched-link
बिना किसी अन्य HTML परिवर्तन के कार्ड के लिंक में कक्षा को सुरक्षित रूप से जोड़ सकते हैं।
विस्तृत लिंक के साथ एकाधिक लिंक और टैप लक्ष्य अनुशंसित नहीं हैं। हालाँकि, कुछ position
और z-index
शैलियाँ इसकी आवश्यकता होने पर मदद कर सकती हैं।
स्ट्रेच्ड लिंक वाला कार्ड
कार्ड के शीर्षक पर निर्माण करने और कार्ड की सामग्री का बड़ा हिस्सा बनाने के लिए कुछ त्वरित उदाहरण टेक्स्ट।
कही चले जाओ<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
स्ट्रेच्ड लिंक वाला मीडिया
ग्रेविडा नाला में क्रैस सिट अमेट निभ लिबरो। नुला वेल मेटस स्केलेरिस्क एंटे सॉलिसिटुडिन। क्रैस पुरुस ओडियो, वेस्टिबुलम इन वल्पुटेट एट, टेम्पस विवेरा टर्पिस। फ्यूस कॉन्डिमेंटम ननक एसी निसी वल्पुटेट फ्रिंजिला। फॉसीबस में डोनेक लैकिनिया कॉन्गू फेलिस।
कही चले जाओ<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>
कॉलम position: relative
डिफ़ॉल्ट रूप से होते हैं, इसलिए क्लिक करने योग्य कॉलम के लिए केवल .stretched-link
लिंक पर क्लास की आवश्यकता होती है। हालाँकि, एक लिंक को संपूर्ण पर खींचने के लिए कॉलम और पंक्ति पर .row
आवश्यकता होती है।.position-static
.position-relative
स्ट्रेच्ड लिंक वाले कॉलम
ग्रेविडा नाला में क्रैस सिट अमेट निभ लिबरो। नुला वेल मेटस स्केलेरिस्क एंटे सॉलिसिटुडिन। क्रैस पुरुस ओडियो, वेस्टिबुलम इन वल्पुटेट एट, टेम्पस विवेरा टर्पिस। फ्यूस कॉन्डिमेंटम ननक एसी निसी वल्पुटेट फ्रिंजिला। फॉसीबस में डोनेक लैकिनिया कॉन्गू फेलिस।
कही चले जाओ<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>
युक्त ब्लॉक की पहचान करना
यदि फैला हुआ लिंक काम नहीं करता है, तो संभवत : इसका कारण होगा। निम्नलिखित सीएसएस गुण तत्व को युक्त ब्लॉक बना देंगे:
- के अलावा एक
position
मूल्यstatic
- A
transform
याperspective
के अलावा अन्य मानnone
- or . का
will-change
मानtransform
perspective
filter
इसके अलावा एक मूल्यnone
या इसकेwill-change
मूल्यfilter
(केवल फ़ायरफ़ॉक्स पर काम करता है)
स्ट्रेच्ड लिंक्स वाला कार्ड
कार्ड के शीर्षक पर निर्माण करने और कार्ड की सामग्री का बड़ा हिस्सा बनाने के लिए कुछ त्वरित उदाहरण टेक्स्ट।
स्ट्रेच्ड लिंक यहां काम नहीं करेगा, क्योंकि 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>