Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> CSS

CSS से इमेज पर टेक्स्ट को बॉटम-लेफ्ट में पोज़िशन करें

इमेज पर टेक्स्ट को बॉटम-लेफ्ट (नीचे बाएं) कोने में रखने के लिए 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>

मुख्य तकनीक

  1. पैरेंट को position: relative दें
  2. चाइल्ड (टेक्स्ट कंटेनर) को position: absolute दें
  3. bottom और left से दूरी सेट करें
  4. पढ़ने योग्यता के लिए सेमी-ट्रांसपेरेंट बैकग्राउंड जोड़ें

अन्य पोज़िशन

  • टॉप-लेफ्ट: top: 10px; left: 10px;
  • टॉप-राइट: top: 10px; right: 10px;
  • बॉटम-राइट: bottom: 10px; right: 10px;
  • सेंटर: top: 50%; left: 50%; transform: translate(-50%, -50%);
  1. CSS से इमेज पर बटन कैसे जोड़ें? CSS से इमेज पर बटन कैसे जोड़ें?

    CSS से इमेज पर बटन जोड़ने का कोड निम्नलिखित है:उदाहरण<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> img{    width: 100%; } div {    position: relative;    width

  1. CSS से टेक्स्ट बटन कैसे स्टाइल करें? CSS से टेक्स्ट बटन कैसे स्टाइल करें?

    CSS का उपयोग करके विभिन्न रंगों और शैलियों के टेक्स्ट बटन बनाए जा सकते हैं। इस उदाहरण में पांच अलग-अलग प्रकार के बटन (Success, Info, Warning, Danger, Default) दिखाए गए हैं जिनमें होवर इफेक्ट भी शामिल है। उदाहरण <!DOCTYPE html> <html> <head> <meta name=viewport content=width=

  1. CSS से ग्लोइंग टेक्स्ट कैसे बनाएं? CSS से ग्लोइंग टेक्स्ट कैसे बनाएं?

    CSS से ग्लोइंग टेक्स्ट बनाने के लिए, कोड निम्नानुसार है -उदाहरण<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style>    body {       background-color: rgb(0, 0, 0);