Bootstrap
موضوعات داغ

آموزش بوت استرپ (جدول ها در بوت استرپ )

آموزش بوت استرپ 4، قسمت 3 (جدول ها )

مستندات و مثالهایی درمورد جداول در  bootstrap 4

به دلیل استفاده زیاد از جدول ها در سایت ها ، بوت استرپ با ایجاد کلاس پایه . table و کلاس های سفارشی ، طراحی را برای  web designer  ها آسان کرده .

به مثال های زیر توجه کنید :

آموزش بوت استرپ، قسمت 3 (جدول ها )
<table class="table">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

همچنین میتوانید رنگ table  ها را با استفاده از کلاس . table-dark تیره کنید.

مثال:

بوت استرپ جدول ها
<table class="table table-dark">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

شما میتوانید با استفاده از . thead-dark  و . thead-light عنوان های جدول های خود را به رنگ تیره و خاکستری روشن تبدیل کنید.

مثال:

بوت استرپ جدول ها
<table class="table">
  <thead class="thead-dark">
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

<table class="table">
  <thead class="thead-light">
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

ردیف های راه راه

برای راه راه کردن گورخری جداول میتوانید از . table-striped  استفاده کنید. برای درک بیشتر به مثال های زیر توجه کنید.

مثال:

جدول ها بوت استرپ
<table class="table table-striped">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

کد4

کلاس table
<table class="table table-striped table-dark">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Border  ها در جداول

با اضافه کردن . table-bordered  در هر چهار طرف table  و سلول ها میتوانید حاشیه ای ایجاد کنید.

مثال:

bootstrap table
<table class="table table-bordered">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

کد 6

آموزش بوت استرپ 4
<table class="table table-bordered table-dark">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

هاورهای ردیف در جداول

. table-hover  را به table  اضافه کنید را تا حالت hover زیبایی برای شما فعال شود.

<table class="table table-hover">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Small table

کلاس . table-sm را اضافه کنید تا جدولی جمع و جورتری داشته باشید.

مثال:

آموزش بوت استرپ
<table class="table table-sm">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

کلاس های متنی در جدول ها

از کلاسهای متنی برای رنگ آمیزی ردیف های جدول یا سلول هااستفاده کنید.

مثال:

بوت استرپ table ها

جداول Responsive

جدول های Responsive به شما این اجازه را میدهد که جداول را به راحتی به صورت افقی اسکرول کنید.

با استفاده از . table-responsive شما میتوانید یک responsive table  داشته باشید.

قابلیتی که بوت استرپ در رسیپانسیو کردن در اختیار ما گذاشته اینست که با دادن sm|md|lg|xl میتوانید حداکثر نقطه شکست را انتخاب کنید.

<div class="table-responsive">
  <table class="table">
    ...
  </table>
</div>
<div class="table-responsive-sm">
  <table class="table">
    ...
  </table>
</div>

<div class="table-responsive-md">
  <table class="table">
    ...
  </table>
</div>

<div class="table-responsive-lg">
  <table class="table">
    ...
  </table>
</div>

<div class="table-responsive-xl">
  <table class="table">
    ...
  </table>
</div>

خب امیدوارم که در حد توانم به شما کمک کرده باشم.

دوستانی که متوجه نشدند اصلا ناراحت نشن ، چون مطمئنا مشکل از بنده بوده که شیوه درستی رو انتخاب نکردم ، آن دسته از عزیزان میتوانند از طریق ایمیل بنده سوالاتشان را مطرح کنند.

برای یادگیری بوت استرپ بخش تایپوگرافی ها و متن ها بر روی لینک کلیک کنید

کلمات کلیدی:آموزش بوت استرپ،آموزش bootstarp 4 (جدول ها)،جدول ها در bootstrap،آموزش،آموزش جدول ها در بوت استرپ

مهدی صالحی

مهدی صالحی هستم برنامه نویس وب و نرم افزار موبایل.دارنده مدارک برنامه نویسی از دانشگاه johns Hopkins و Michigan آمریکا عاشق هک و این دنیای باحال برنامه نویسی

دیدگاهتان را بنویسید

دکمه بازگشت به بالا