Introdução ao layout de tabela Tailwind

Neste artigo, exploraremos o Tailwind Table Layout e como ele pode ser usado para criar tabelas responsivas e dinâmicas.

As tabelas são uma parte essencial do desenvolvimento web, permitindo-nos apresentar os dados de forma clara e organizada. No entanto, projetar um layout de mesa pode ser um desafio, especialmente se você deseja torná-lo bonito e responsivo em diferentes dispositivos.

Usando a classe de layout da tabela no Tailwind , podemos definir a exibição do layout da tabela para controlar a aparência da tabela.



Classes de Layout de Tabela Tailwind

Vamos dar uma olhada nas classes de layout de tabela disponíveis no Tailwind:

Aulas Visão geral
table-auto A classe table-auto pode ser aplicada a um elemento de tabela para ajustar automaticamente a largura da tabela e suas células com base no conteúdo.
mesa fixa A classe CSS Tailwind fixa em tabela aplica um layout fixo a um elemento de tabela.

Sintaxe

<element class="table-auto">...</element>

Este exemplo se concentra na classe table-auto para implementação no Tailwind:

Example: 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html><head>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="m-3 text-center">
<h1 class="text-gray-700 text-2xl font-semibold">
MrExamples
</h1>
<p class="my-2 font-medium">Table Layout Class in Tailwind</p>
<p class="font-medium text-gray-500 my-2 text-sm">Using table-auto class</p>
<div class="bg-amber-200">
<table class="table-auto border border-slate-800">
<thead>
<tr>
<th class="border border-slate-800 p-2">Languages</th>
<th class="border border-slate-800">About</th>
</tr>
</thead>
<tbody class="font-medium">
<tr>
<td class="border border-slate-800">Python</td>
<td class="border border-slate-800 p-2">
Python is a popular general-purpose programming
language. Among its many uses are machine learning,
web development, desktop applications, and many others.
</td>
</tr>
<tr>
<td class="border border-slate-800">Java</td>
<td class="border border-slate-800 p-2">
The Java programming language is a powerful
general-purpose programming language. A wide
range of applications can be developed with it,
including desktop and mobile applications,
embedded systems, big data processing, and so on.
</td>
</tr>
<tr>
<td class="border border-slate-800">Bootstrap</td>
<td class="border border-slate-800 p-2">
JavaScript is one of the most powerful and
flexible programming languages available today.
Using it, we can make interactive webpages with
popup menus, animations, and form validation.
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
No exemplo a seguir, o Tailwind ilustra como usar a classe table-fixed :

Example: 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html><head>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="m-3 text-center">
<h1 class="text-gray-700 text-2xl font-semibold">
MrExamples
</h1>
<p class="my-2 font-medium">Table Layout Class in Tailwind</p>
<p class="font-medium text-gray-500 my-2 text-sm">Using table-fixed class</p>
<div class="bg-amber-200">
<table class="table-fixed border border-slate-800">
<thead>
<tr>
<th class="border border-slate-800 p-2 w-1/4">Languages</th>
<th class="border border-slate-800 w-3/4">About</th>
</tr>
</thead>
<tbody class="font-medium">
<tr>
<td class="border border-slate-800">Python</td>
<td class="border border-slate-800 p-2">
Python is a popular general-purpose programming
language. Among its many uses are machine learning,
web development, desktop applications, and many others.
</td>
</tr>
<tr>
<td class="border border-slate-800">Java</td>
<td class="border border-slate-800 p-2">
The Java programming language is a powerful
general-purpose programming language. A wide
range of applications can be developed with it,
including desktop and mobile applications,
embedded systems, big data processing, and so on.
</td>
</tr>
<tr>
<td class="border border-slate-800">Bootstrap</td>
<td class="border border-slate-800 p-2">
JavaScript is one of the most powerful and
flexible programming languages available today.
Using it, we can make interactive webpages with
popup menus, animations, and form validation.
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Nós valorizamos o seu feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Assine a nossa newsletter
Digite seu e-mail para receber um resumo semanal de nossos melhores posts. Saber mais!
ícone