इमेज पर टेक्स्ट को बॉटम-लेफ्ट (नीचे बाएं) कोने में रखने के लिए position: absolute के साथ bottom और left प्रॉपर्टीज़ का उपयोग करें। पैरेंट कंटेनर को position: relative होना चाहिए।
उदाहरण: इमेज पर बॉटम-लेफ्ट टेक्स्ट
<!DOCTYPE html>
<html>
<head>
<style>
.box {
position: relative;
display: inline-block;
max-width: 100%;
}
img {
width: 100%;
height: auto;
opacity: 0.6;
display: block;
}
.direction {
position: absolute;
bottom: 10px;
left: 19px;
font-size: 13px;
color: white;
background: rgba(0,0,0,0.5);
padding: 5px 10px;
border-radius: 3px;
}
</style>
</head>
<body>
<h1>हेडिंग वन</h1>
<p>नीचे दी गई इमेज में टेक्स्ट बॉटम-लेफ्ट में है:</p>
<div class="box">
<img src="https://www.tutorialspoint.com/python/images/python_data_science.jpg" alt="Tutorial" width="800" height="400">
<div class="direction">बॉटम लेफ्ट कॉर्नर</div>
</div>
</body>
</html>
मुख्य तकनीक
- पैरेंट को
position: relativeदें - चाइल्ड (टेक्स्ट कंटेनर) को
position: absoluteदें bottomऔरleftसे दूरी सेट करें- पढ़ने योग्यता के लिए सेमी-ट्रांसपेरेंट बैकग्राउंड जोड़ें
अन्य पोज़िशन
- टॉप-लेफ्ट:
top: 10px; left: 10px; - टॉप-राइट:
top: 10px; right: 10px; - बॉटम-राइट:
bottom: 10px; right: 10px; - सेंटर:
top: 50%; left: 50%; transform: translate(-50%, -50%);