কম্পিউটার

CSS-এ স্ক্রলে ফিক্সড হেডার সহ HTML টেবিল


অবস্থান নির্ধারণ করে:স্টিকি এবং শীর্ষ:0, আমরা HTML টেবিলে একটি স্ক্রলে একটি নির্দিষ্ট শিরোনাম তৈরি করতে পারি।

উদাহরণ

নিচের উদাহরণগুলো আমাদেরকে এই −

কে কিভাবে বাস্তবায়ন করতে হয় তার একটি ধারণা দেয়
<!DOCTYPE html>
<html>
<head>
<style>
div {
   color: white;
   display: flex;
   padding: 2%;
   background-color: rgba(190,155,150);
   height: 135px;
   overflow-y: scroll;
}
td,th,p {
   text-align: center;
   font-size: 1.25em;
}
table {
   padding: 3%;
   border-collapse: collapse;
   border: 2px ridge green;
}
th {
   top: 0;
   position: sticky;
   background: #e5d2f1;
   color: black;
}
</style>
</head>
<body>
<div>
<table>
<thead>
<tr>
<th>A </th>
<th>B </th>
<th>C </th>
<th>D </th>
<th>E </th>
</tr>
</thead>
<tr>
<td>Hey</td>
<td>Hey</td>
<td>Hey</td>
<td>Hey</td>
<td>Hey</td>
</tr>
<tr>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
</tr>
<tr>
<td>Yo</td>
<td>Yo</td>
<td>Yo</td>
<td>Yo</td>
<td>Yo</td>
</tr>
<tr>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
</tr>
</table>
<p>
Duis tincidunt fermentum ipsum vel sagittis. Sed ultrices quis dui ut rutrum. Quisque et varius tellus, ut vestibulum purus. Etiam in erat fringilla, laoreet libero eu, facilisis ante. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Duis eu ornare augue, ut facilisis odio.
</p>
</div>
</body>
</html>

আউটপুট

এটি নিম্নলিখিত ফলাফল তৈরি করবে -

CSS-এ স্ক্রলে ফিক্সড হেডার সহ HTML টেবিল

উদাহরণ

<!DOCTYPE html>
<html>
<head>
<style>
div {
   padding: 2%;
   height: 40px;
   overflow-y: scroll;
   box-shadow: inset 0 0 12px lightgreen;
}
tr th {
   background: #25f2f1;
}
table {
   text-align: center;
   position: relative;
   border-collapse: separated;
   width: 100%;
}
th {
   top: 0;
   position: sticky;
   background: white;
}
</style>
</head>
<body>
<div>
<table>
<thead>
<tr>
<th>A </th>
<th>B </th>
<th>C </th>
<th>D </th>
<th>E </th>
</tr>
</thead>
<tr>
<td>Hey</td>
<td>Hey</td>
<td>Hey</td>
<td>Hey</td>
<td>Hey</td>
</tr>
<tr>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
</tr>
<tr>
<td>Yo</td>
<td>Yo</td>
<td>Yo</td>
<td>Yo</td>
<td>Yo</td>
</tr>
<tr>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
<td>Demo</td>
</tr>
</table>
</div>
</body>
</html>

আউটপুট

এটি নিম্নলিখিত ফলাফল তৈরি করবে -

CSS-এ স্ক্রলে ফিক্সড হেডার সহ HTML টেবিল


  1. কিভাবে CSS এর সাথে একটি তুলনা টেবিল তৈরি করবেন?

  2. কিভাবে CSS দিয়ে একটি প্রতিক্রিয়াশীল টেবিল তৈরি করবেন?

  3. সিএসএস এবং জাভাস্ক্রিপ্ট দিয়ে স্ক্রলে একটি শিরোনাম কীভাবে সঙ্কুচিত করবেন?

  4. কিভাবে CSS দিয়ে একটি অন স্ক্রোল ফিক্সড নেভিগেশন বার তৈরি করবেন?