# CSS Tables

# **CSS Tables**

# Table Borders

To specify table borders in CSS, use the `border` property.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686741872237/85483f05-b10a-4b21-a75e-a8f24dafe8e6.png align="center")

## **Table Size**

Table Width and Height

The width and height of a table are defined by the `width` and `height` properties.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686741916645/a972a4de-95b7-4517-9818-ad0668afb484.png align="center")

# Horizontal Alignment

The `text-align` property sets the horizontal alignment (like left, right, or center) of the content in &lt;th&gt; or &lt;td&gt;.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686741953611/ca87b514-0afa-4db8-af74-4defc1c66835.png align="center")

# Vertical Alignment

The `vertical-align` property sets the vertical alignment (like top, bottom, or middle) of the content in &lt;th&gt; or &lt;td&gt;.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686742002568/e19ca0e1-dbef-44a0-a182-495f56ed225d.png align="center")

## **Table Style**

To control the space between the border and the content in a table, use the `padding`  property on &lt;td&gt; and &lt;th&gt; elements:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686742048681/0b1e7eef-85ff-40b3-a841-f4eba380a1e7.png align="center")

Example👇🏻

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686742089277/285df7a8-d37a-4703-a57a-4568e55a6538.png align="center")

---

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1666336375150/5HqI8zNVh.png align="left")

Download our HTML & CSS Visual Treat! ebook Here: [Click here](https://codemarch.gumroad.com/l/hxazr)
