
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
Set the left, right, top and bottom padding of an element
The padding property sets the left, right, top and bottom padding of an element. You can try to run the following code to implement padding property.
Example
<html> <head> </head> <body> <p style = "padding: 25px; border:2px solid orange;"> This is a paragraph. </p> <p style = "padding:20px 4%; border:2px solid red;"> This is another paragraph. </p> <p style = "padding: 15px 3% 10px; border:1px solid maroon;"> Top padding will be 15px, left and right padding will be 3% of the total width of the document, bottom padding will be 10px </p> </body> </html>
- Related Articles
- How to set the bottom padding of an element with JavaScript?
- How to set the top padding of an element with JavaScript?
- How to set the left padding of an element with JavaScript?
- How to set the right padding of an element with JavaScript?
- Specify the bottom padding of an element with CSS
- Specify the top padding of an element with CSS
- Specify the left padding of an element with CSS
- Specify the right padding of an element with CSS
- How to set the padding of an element with JavaScript?
- Maximum points from top left of matrix to bottom right and return back in C++
- How to set the bottom margin of an element?
- How to display the JList items from top to bottom and left to right in Java?
- Program to count number of walls required to partition top-left and bottom-right cells in Python
- Left-justify elements of an array and set the characters to use for padding in Numpy
- Right-justify elements of an array and set the characters to use for padding in Numpy

Advertisements