• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Css » Tutorial » CSS padding property
Next →
← Prev

CSS padding property

By Dinesh Thakur

Padding is the property that is used to set the amount of space between the contents of an element and its border. The values that can be set for this property can be in terms of length or percentage. Percentage value refers to width of the parent element. Negative values are not permitted. For example:

P{border-style : solid;  Padding : 30px;  }

On specifying, it will set a solid border around <p> element in your webpage such that the amount of space between the contents of an element and its border will be 30 pixels.

You can also set the space between the contents and the top, right, left and bottom sides using PADDING-TOP, PADDING-RIGHT, PADDING-LEFT and PADDING-BOTTOM properties respectively. For example:

P{border-style : solid;  Padding-top : 10px;  Padding-left : 30px;  }

Padding is a shorthand property for PADDING-TOP, PADDING-RIGHT, PADDING-BOTTOM and PADDING-LEFT properties. You can also set the padding for Top, Right, bottom and left sides in a single statement. The order in which these specified values will appear are padding values for top, right, bottom and left sides. For example:

P {border-style : solid;  Padding : 10px 0 0 30px;  }

If two or three values are given then the omitted values are taken from the opposite side. If only two values are given then the top and bottom padding takes on the first value and right and left padding are set to second. If three values are given then the top padding is set to first value, right and left padding are set to second and the bottom padding is set to the third value.

You’ll also like:

  1. CSS margin property
  2. CSS font property
  3. CSS position property
  4. CSS background property
  5. CSS border-style property
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

CSS Tutorials

CSS Tutorials

  • CSS - Font Property
  • CSS - Background Property
  • CSS - CSS - Border-Style Property
  • CSS - Text-Decoration Property
  • CSS - Tables
  • CSS - Position
  • CSS - Syntax and Selectors
  • CSS - List
  • CSS - Margin
  • CSS - Padding

Other Links

  • CSS Tutorials - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW