Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.3 kB
2
Indexable
Never
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <!-- Menggunakan Bootstrap CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <title>Text Posisi Atas Bawah dalam TD</title>
</head>
<body>

  <table class="table">
    <thead>
      <tr>
        <th scope="col">Judul Kolom 1</th>
        <th scope="col">Judul Kolom 2</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="position-relative">
          <div class="position-absolute top-0 start-50 translate-middle text-center">
            <h4>Text di Atas</h4>
          </div>
          <div class="text-center">
            Konten Sel
          </div>
          <div class="position-absolute bottom-0 start-50 translate-middle text-center mt-2">
            <h4>Text di Bawah</h4>
          </div>
        </td>
        <td>
          <!-- Konten Sel lainnya -->
        </td>
      </tr>
      <!-- Baris data lainnya -->
    </tbody>
  </table>

  <!-- Menggunakan Bootstrap JS (diperlukan untuk beberapa fitur Bootstrap) -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Leave a Comment