---
title: "What is the CSS property to specify the space between the content of an element and its border?"  
description: "What is the CSS property to specify the space between the content of an element and its border?"  
author: "Utpal Vishwas"  
published: 2023-06-06  
updated: 2023-06-07  
canonical: https://www.mindstick.com/forum/158663/what-is-the-css-property-to-specify-the-space-between-the-content-of-an-element-and-its-border  
category: "css-css3"  
tags: ["css", "css line hight"]  
reading_time: 2 minutes  

---

# What is the CSS property to specify the space between the content of an element and its border?

What is the [CSS](https://www.mindstick.com/forum/514/background-gradient-ie7-css-problem) [property](https://www.mindstick.com/blog/205/property-notification-in-c-sharp) to specify the [space](https://www.mindstick.com/articles/12954/do-your-electrical-repair-in-your-own-space) between the [content](https://www.mindstick.com/articles/13019/get-the-best-content-marketing-pricing-packages-for-your-brand) of an element and its border?

## Replies

### Reply by Aryan Kumar

The CSS property to specify the space between the content of an element and its border is **padding**. The padding property can be used to add space to all four sides of an element, or to specific sides of an element.

The padding property is a shorthand property for the following properties:

- **padding-top**
- **padding-right**
- **padding-bottom**
- **padding-left**

For example, the following CSS code will add 10 pixels of padding to all four sides of an element:

Code snippet

```plaintext
element {
  padding: 10px;
}
```

The following CSS code will add 10 pixels of padding to the top and bottom of an element, and 20 pixels of padding to the left and right of an element:

Code snippet

```plaintext
element {
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: 20px;
  padding-right: 20px;
}
```

The padding property can also be used to add different amounts of padding to different sides of an element. For example, the following CSS code will add 10 pixels of padding to the top and bottom of an element, and 20 pixels of padding to the left and right of an element:

Code snippet

```plaintext
element {
  padding: 10px 20px;
}
```

The padding property can be used to create a variety of effects, such as adding a border around an element, or creating a space between the content of an element and its border.

Here are some additional tips for using the padding property:

- Use the same value for all four sides of an element to create a uniform border.
- Use different values for different sides of an element to create a more asymmetrical border.
- Use the padding property to create a space between the content of an element and its border.

By following these tips, you can use the padding property to create a variety of effects in your CSS code.


---

Original Source: https://www.mindstick.com/forum/158663/what-is-the-css-property-to-specify-the-space-between-the-content-of-an-element-and-its-border

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
