**CSS and HTML Table Examples: Enhance Data Presentation**
Tables are an essential aspect of web design, used to present data in an organized and easily consumable manner. With CSS, we can style these tables to make them more appealing and user-friendly. Let's explore some CSS HTML table examples to help you create engaging tables for your web pages.

Firstly, let's understand the basic structure of an HTML table:

```html
| Heading 1 | Heading 2 |
|---|---|
| Data 1 | Data 2 |
```
Basic CSS Styles for Tables

CSS provides numerous properties to style tables. We'll start with some basics:
| Heading 1 | Heading 2 |
|---|---|
| Data 1 | Data 2 |

Styling Table Headers
You can differentiate headers from data cells using the <th> tag and different styles:
```css th { background-color: #f2f2f2; font-weight: bold; } ```
Altering Table Rows

Create alternating row colors for easier reading:
```css tr:nth-child(even) { background-color: #f2f2f2; } ```
Responsive Tables for Mobile Devices
For tables to be mobile-friendly, use CSS media queries and adjust the table layout:

```css @media screen and (max-width: 600px) { table, thead, tbody, th, td, tr { display: block; } thead tr { position: absolute; top: -9999px; left: -9999px; } tr:nth-of-type(odd) { background-color: #f2f2f2; } td { border-bottom: 1px solid #eee; position: relative; padding-left: 50%; } td::before { position: absolute; left: 6px; width: 45%; padding-right: 10px; white-space: nowrap; content: attr(data-label); } } ```
This media query changes the table layout to a stacked format, ideal for small screens. It uses the data-label attribute in the <td> tag to help identify each column.
In conclusion, CSS offers countless ways to style HTML tables, improving their aesthetics and usability. Play around with different styles and responsive designs to create engaging data presenters for your web pages. Happy coding!



















