How to Set Padding-top in Bootstrap

Bootstrap Padding-top

Learn How to set padding-top in bootstrap with example code. Padding indicates the space around the content of an element.

Basic syntax:

[property side] {-size}

where:

  • property:p = p: indicates padding
  • side: t = top

Note: If you do not specify the side then it indicates all sides.

  • size: 0,1,2,3,4 or 5

Note: if you do not specify the device then it indicates in any screen size device

Example

<div style="border: 1px solid black; width: 40%;" class="pt-5">Padding Top</div>

Output:

bootstrap padding-top

To add padding-top using bootstrap, we need to use “pt-5” in class. It sets 32px of padding on top.

Leave a Reply