31 lines
798 B
Markdown
31 lines
798 B
Markdown
---
|
|
title: Styling Tables
|
|
---
|
|
## Styling Tables
|
|
|
|
Tables can be styled with css properties, such as ```table-layout```,```border```,```border-collapse```,```border-spacing```,```width```,```height```,```text-align```,```font```,```color```,```empty-cells```, ```caption-side```, etc.
|
|
|
|
### Example
|
|
```css
|
|
/*set table border to solid black*/
|
|
table, th, td {
|
|
border: 1px solid black;
|
|
}
|
|
table {
|
|
border-collapse: collapse;
|
|
}
|
|
/*set padding of 15px to all table elements and aligns to left*/
|
|
th, td {
|
|
padding: 15px;
|
|
text-align: left;
|
|
}
|
|
```
|
|
|
|
#### More Information:
|
|
|
|
- [MDN](https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_boxes/Styling_tables)
|
|
- [w3schools](https://www.w3schools.com/css/css_table.asp)
|
|
- [CSS Tricks](https://css-tricks.com/complete-guide-table-element/)
|
|
|
|
|