To change padding of paragraph using CSS, you can set the padding
style property for the paragraph elements with the values like 20px
, 2rem
, 1.1in
, etc.
The following is the typical CSS code to change padding of paragraph in HTML page using tag name p
.
p {
padding: 20px;
}
p {
padding: 2rem;
}
p {
padding: 1.1in;
}
We shall go through some working examples on how to change padding of paragraph using CSS. In the following examples, you may change the value of padding and Run the code to visually observe the changes made to the Paragraph elements.
This is an example on how to change padding of paragraph using pixels for padding.
You may edit the following code, and click on Run button.
This is an example on how to change padding of paragraph using padding relative to parent dimensions.
You may edit the following code, and click on Run button.
This is an example on how to change padding of paragraph using inches for padding.
You may edit the following code, and click on Run button.