- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
The padding shorthand Property in CSS
The padding property in CSS allows you to set the padding for padding-top, padding-right, padding-bottom, padding-left. It is a shorthand property.
Let us first see an example −
For example: padding:10px 5px 7px 10px;
Here,
top padding is 10px right padding is 5px bottom padding is 7px left padding is 10px
Example
The following examples illustrate CSS padding property −
<!DOCTYPE html> <html> <head> <style> div { height: 150px; width: 300px; padding: 5% 10% 20% 5%; background-image: url("https://www.tutorialspoint.com/images/home_tensor_flow.png"); text-align: center; font-weight: bold; font-size: 1.2em; box-sizing: border-box; } div > div { border-radius: 80px; padding: 2em 2em; box-shadow: 0 0 4px 0.8px black; } </style> </head> <body> <div>Learn TensorFlow <div>TensorFlow is an open source machine learning framework for all developers.</div> </div> </body> </html>
Output
This gives the following output
Example
<!DOCTYPE html> <html> <head> <style> div { height: 150px; width: 100px; padding: 5% 1%; background-color: papayawhip; border-radius: 5%; box-sizing: border-box; } div > div { width: 50px; height: 50px; border-radius: 50%; padding: 2em; box-shadow: 0 0 9px 1px black; } span { padding: 10px; } </style> </head> <body> <div> <div></div> <span><i>button</i></span> </div> </body> </html>
Output
This gives the following output −
- Related Articles
- The margin Shorthand Property in CSS
- The border Shorthand Property in CSS
- The outline Shorthand Property in CSS
- The Background Shorthand Property in CSS
- CSS Animation Shorthand property
- CSS padding property
- The list-style Shorthand property in CSS
- CSS padding-right property
- CSS padding-bottom property
- CSS padding-top property
- CSS padding-left property
- Shorthand property to set the background in CSS
- Animate CSS padding-bottom property
- Animate CSS padding-left property
- Animate CSS padding-right property

Advertisements