Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

วิธีจัดตำแหน่งข้อความไว้ที่ด้านล่างซ้ายของรูปภาพด้วย CSS


หากต้องการวางข้อความไว้ที่ด้านล่างซ้าย ให้ใช้ด้านล่าง และ ซ้าย คุณสมบัติ. คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อจัดตำแหน่งข้อความที่ด้านล่างซ้ายของรูปภาพ

ตัวอย่าง

<!DOCTYPE html>
<html>
   <head>
      <style>
         .box {
            position: relative;
         }
         img {
            width: 100%;
            height: auto;
            opacity: 0.6;
         }
         .direction {
            position: absolute;
            bottom: 10px;
            left: 19px;
            font-size: 13px;
         }
      </style>
   </head>
   <body>
      <h1>Heading One</h1>
      <p>Below image has text in the bottom left:</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">Bottom Left Corner</div>
      </div>
   </body>
</html>