কম্পিউটার টিউটোরিয়াল

HTML DOM Table createCaption() মেথড: টেবিলে ক্যাপশন যোগ করা

HTML DOM table createCaption() মেথড একটি খালি <caption> এলিমেন্ট তৈরি করে এবং এটিকে HTML ডকুমেন্টের টেবিলে যোগ করে।

সিনট্যাক্স

সিনট্যাক্স নিচে দেওয়া হলো:

object.createCaption()

উদাহরণ

HTML DOM table createCaption() মেথডের একটি উদাহরণ:

<!DOCTYPE html> <html> <style>    body {       color: #000;       background: lightblue;       height: 100vh;       text-align: center;    }    table {       margin: 2rem auto;    }    caption {       color: #db133a;    }    .btn {       background: #db133a;       border: none;       height: 2rem;       border-radius: 2px;       width: 40%;       display: block;       color: #fff;       outline: none;       cursor: pointer;       margin: 1rem auto;    }    .show {       font-size: 1.2rem;    } </style> <body> <h1>DOM Table createCaption() Method Demo</h1> <table border="2"> <tr> <td>Name</td> <td>Roll No.</td> </tr> <tr> <td>John</td> <td>071717</td> </tr> <tr> <td>Jane</td> <td>031717</td> </tr> </table> <button onclick="create()" class="btn">Create Caption</button> <script>    function create() {       var tableCaption = document.querySelector('table').createCaption();       tableCaption.innerHTML = "Student Data";    } </script> </body> </html>

আউটপুট

HTML DOM Table createCaption() মেথড: টেবিলে ক্যাপশন যোগ করা

"Create Caption" বাটনে ক্লিক করুন টেবিলের জন্য একটি ক্যাপশন তৈরি করতে।

HTML DOM Table createCaption() মেথড: টেবিলে ক্যাপশন যোগ করা

  1. HTML DOM Table tHead প্রোপার্টি: টেবিল হেডার (thead) অ্যাক্সেস

  2. HTML DOM Table tFoot প্রোপার্টি: টেবিল ফুটার (tfoot) অ্যাক্সেস

  3. HTML DOM tagName প্রপার্টি

  4. HTML DOM Style captionSide প্রপার্টি