
The space between the content and its border is named padding.
The CSS padding-right property settles the right padding (right space) of an element.
Demo:
Click the “Try it” button to change the padding-right property of the paragraph (100px):
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat…
Syntax:
padding-right: length;
length – defines fixed right padding in px, cm, etc.
Example:
<!DOCTYPE html>
<html>
<head>
<style>
.ex1 {
border: 1px solid #333;
padding-right: 200px;
}
</style>
</head>
<body>
<p class="ex1">This is a paragraph with a 250px right padding.This is a paragraph with a 250px right padding.This is a paragraph with a 200px right padding.</p>
</body>
</html>
Output:
This is a paragraph with a 250px right padding.This is a paragraph with a 250px right padding.This is a paragraph with a 200px right padding.
Enjoy coding!
Read also: