CSS Basic Tutorial
CSS Flexbox
In CSS, tables can be styled to enhance their appearance and make them more visually appealing. Tables consist of elements such as <table>
, <thead>
, <tbody>
, <tr>
, <th>
, and <td>
. CSS allows you to style each of these elements, adjusting borders, spacing, background colors, and more.
The border-collapse
determines whether table borders are collapsed into a single border or separated.
border-collapse : collapse | separate;
The border-spacing
specifies the spacing between borders when border-collapse: separate
is used.
border-spacing : <value>;
Value: Can be specified in various units such as pixels (px
), percentages (%
), ems (em
), rems (rem
), viewport units (vw
, vh
), or keywords like auto
and inherit
.
The text-align
aligns the content of table cells. Default for <th>
is center
, and for <td>
, it's left
.
text-align : left | right | center | justify;
The vertical-align
aligns the content vertically within table cells.
vertical-align : top | bottom | center;