Lompat ke konten Lompat ke sidebar Lompat ke footer

Mengatur Posisi Caption HTML Menggunakan captionSide Style DOM

Properti captionSide Style DOM pada HTML merupakan properti yang digunakan untuk mengatur atau mengembalikan nilai posisi dari caption sebuah tabel.

4 Contoh Properti captionSide Style DOM pada HTML
Ilustrasi captionSide DOM

Sebelum memahami lebih dalam materi tentang Mengatur Posisi Caption HTML Menggunakan captionSide Style DOM, terlebih dahulu pelajari materi tentang: Mengatur Kotak Ukuran HTML Menggunakan boxSizing Style DOM [klik], Mengatur Bayangan Kotak HTML Menggunakan boxShadow Style DOM [klik], dan Mengatur Batas Lebar HTML Menggunakan borderWidth Style DOM [klik].

Sintak:
  • untuk mendapatkan nilai properti captionSide: object.style.captionSide
  • untuk mengatur nilai properti captionSide: object.style.captionSide = "bottom|top|initial|inherit"

Return Values: berfungsi untuk mengembalikan sebuah nilai string, yang merepresentasikan posisi dari caption tabel.

Baca Juga:

Property Values:
  • bottom: digunakan untuk posisi caption bagian bawah.
  • top: digunakan untuk posisi caption bagian atas, dan merupakan nilai default dari properti captionSide.
  • initial: digunakan untuk mengatur nilai properti ke nilai default-nya.
  • inherit: digunakan untuk menerima nilai turunan properti yang berasal dari parent.

Contoh:

<!DOCTYPE html>

<html>

 

<head>

 

<title>

Properti Style captionSide DOM

</title>

 

<style>

th,td 

{

border: 2px solid black;

padding: 10px;

margin: 10px;

}

</style>

 

</head>

 

<body>

 

<h1 

style="color: green">

Blog Elfan

</h1>

 

<b>

Properti Style captionSide DOM

</b>

 

<table>

 

<caption 

id="caption1">

Daftar Buku-buku

</caption>

 

<tr>

<th>Book</th>

<th>Author</th>

<th>Price</th>

</tr>

 

<tr>

<td>Bahasa Java</td>

<td>Luffy, Sanji</td>

<td>501</td>

</tr>

 

<tr>

<td>Pengenalan Algoritma</td>

<td>Buggy</td>

<td>1001</td>

</tr>

 

</table>

 

<button 

onclick="setCaptionSide()"

style="margin-top: 10px">

Set captionSide

</button>

 

<!-- Script untuk mengatur 

captionSide ke bottom -->

<script>

function setCaptionSide() 

{

elem = document.querySelector('#caption1');

elem.style.captionSide = 'bottom';

}

</script>

 

</body>

 

</html>

Output:

Blog Elfan

Properti Style captionSide DOM
Daftar Buku-buku
BookAuthorPrice
Bahasa JavaLuffy, Sanji501
Pengenalan AlgoritmaBuggy1001


Contoh:

<!DOCTYPE html>

<html>

 

<head>

 

<title>

Properti Style captionSide DOM

</title>

 

<style>

th,td 

{

border: 2px solid black;

padding: 10px;

margin: 10px;

}

 

#caption2 

{

caption-side: bottom;

}

</style>

 

</head>

 

<body>

 

<h1 

style="color: green">

Blog Elfan

</h1>

 

<b>

Properti Style captionSide DOM

</b>

 

<table>

 

<caption 

id="caption2">

Daftar buku-buku

</caption>

 

<tr>

<th>Book</th>

<th>Author</th>

<th>Price</th>

</tr>

 

<tr>

<td>Berkuli</td>

<td>Bill Jim, Loina</td>

<td>502</td>

</tr>

 

<tr>

<td>Perkenalan kuli</td>

<td>CLRT</td>

<td>1002</td>

</tr>

 

</table>

 

<button 

onclick="setCaptionSide()"

style="margin-top: 10px">

Set captionSide

</button>

 

<!-- Script untuk mengatur 

captionSide ke top -->

<script>

function setCaptionSide() 

{

elem = document.querySelector('#caption2');

elem.style.captionSide = 'top';

}

</script>

 

</body>

 

</html>

Output:

Blog Elfan

Properti Style captionSide DOM
Daftar buku-buku
BookAuthorPrice
BerkuliBill Jim, Loina502
Perkenalan kuliCLRT1002


Contoh:

<!DOCTYPE html>

<html>

 

<head>

 

<title>

Properti Style captionSide DOM

</title>

 

<style>

th,td 

{

border: 2px solid black;

padding: 10px;

margin: 10px;

}

 

#caption3 

{

caption-side: bottom;

}

</style>

 

</head>

 

<body>

 

<h1 

style="color: green">

Blog Elfan

</h1>

 

<b>

Properti Style captionSide DOM

</b>

 

<table>

 

<caption 

id="caption3">

Daftar Buku

</caption>

 

<tr>

<th>Book</th>

<th>Author</th>

<th>Price</th>

</tr>

 

<tr>

<td>Kuli Java</td>

<td>Junaidi, Juleha</td>

<td>503</td>

</tr>

 

<tr>

<td>Perkenanan Kebun Kopi</td>

<td>CLRE</td>

<td>1003</td>

</tr>

 

</table>

 

<button 

onclick="setCaptionSide()"

style="margin-top: 10px">

Set captionSide

</button>

 

<!-- Script untuk mengatur 

captionSide ke initial -->

<script>

function setCaptionSide() 

{

elem = document.querySelector('#caption3');

elem.style.captionSide = 'initial';

}

</script>

 

</body>

 

</html>

Output:

Blog Elfan

Properti Style captionSide DOM
Daftar Buku
BookAuthorPrice
Kuli JavaJunaidi, Juleha503
Perkenanan Kebun KopiCLRE1003


Contoh:

<!DOCTYPE html>

<html>

 

<head>

 

<title>

Properti Style captionSide DOM

</title>

 

<style>

th,td 

{

border: 2px solid black;

padding: 10px;

margin: 10px;

}

 

#parent 

{

caption-side: bottom;

}

</style>

 

</head>

 

<body>

 

<h1 

style="color: green">

Blog Elfan

</h1>

 

<b>

Properti Style captionSide DOM

</b>

 

<div 

id="parent">

 

<table>

 

<caption 

id="caption1"

style="caption-side: top">

Daftar Buku

</caption>

 

<tr>

<th>Book</th>

<th>Author</th>

<th>Price</th>

</tr>

 

<tr>

<td>Adu kambing</td>

<td>Sumira, Darmini</td>

<td>504</td>

</tr>

 

<tr>

<td>Pengenalatan Judi Slot</td>

<td>CLRY</td>

<td>1004</td>

</tr>

 

</table>

 

</div>

 

<button 

onclick="setCaptionSide()"

style="margin-top: 10px">

Set captionSide

</button>

 

<!-- Script untuk mengatur 

captionSide ke inherit -->

<script>

function setCaptionSide() 

{

elem = document.querySelector('#caption1');

elem.style.captionSide = 'inherit';

}

</script>

 

</body>

 

</html>

Output:

Blog Elfan

Properti Style captionSide DOM
Daftar Buku
BookAuthorPrice
Adu kambingSumira, Darmini504
Pengenalatan Judi SlotCLRY1004

Artikel ini didedikasikan kepada: Mustika Rini, Nabila Astri Ariyana, Nadia Rizki Rahmadani, Nicholas Valentino Febrianto, dan Noventi Siti Nur Aisa Putri.

5 komentar untuk "Mengatur Posisi Caption HTML Menggunakan captionSide Style DOM"

  1. Jenis browser apa saja yang dapat digunakan untuk mengaktifkan properti captionSide Style DOM pada HTML?

    BalasHapus
    Balasan
    1. Berikut ini adalah beberapa contoh browser populer yang dapat digunakan untuk mengaktifkan properti captionSide Style DOM pada HTML:
      1. Google Chrome
      2. Internet Explorer 9.0
      3. Firefox
      4. Opera

      Hapus
  2. Apa yang dimaksud dengan properti captionSide Style DOM pada HTML?

    BalasHapus
    Balasan
    1. Properti captionSide Style DOM pada HTML digunakan untuk mengatur atau mengembalikan nilai posisi title dari tabel pada dokumen HTML.

      Hapus
    2. Properti captionSide Style DOM pada HTML digunakan untuk mengatur atau mengembalikan nilai posisi title tabel.

      Hapus

Hubungi admin melalui Wa : +62-896-2414-6106

Respon komentar 7 x 24 jam, mohon bersabar jika komentar tidak langsung dipublikasi atau mendapatkan balasan secara langsung.

Bantu admin meningkatkan kualitas blog dengan melaporkan berbagai permasalahan seperti typo, link bermasalah, dan lain sebagainya melalui kolom komentar.

- Ikatlah Ilmu dengan Memostingkannya -
- Big things start from small things -