SlideShare a Scribd company logo
2
Most read
3
Most read
12
Most read
CSS - Padding
CSS - Padding
The padding property allows you to specify how much space should appear between the
content of an element and its border −
The value of this attribute should be either a length, a percentage, or the word inherit. If the
value is inherit, it will have the same padding as its parent element. If a percentage is used,
the percentage is of the containing box.
The following CSS properties can be used to control lists. You can also set different values
for the padding on each side of the box using the following properties −
• The padding-bottom specifies the bottom padding of an element.
• The padding-top specifies the top padding of an element.
• The padding-left specifies the left padding of an element.
• The padding-right specifies the right padding of an element.
• The padding serves as shorthand for the preceding properties.
The padding-bottom Property :
• The padding-bottom property sets the bottom padding (space) of an element. This can take a value in
terms of length of %.
• Here is an example −
<html>
<head>
</head>
<body>
<p style = "padding-bottom: 15px; border:1px solid black;">
This is a paragraph with a specified bottom padding
</p>
<p style = "padding-bottom: 5%; border:1px solid black;">
This is another paragraph with a specified bottom padding in percent
</p>
</body>
</html>
It will produce the following result −
The padding-top Property :
• The padding-top property sets the top padding (space) of an element. This can take a value in terms of
length of %.
• Here is an example −
<html>
<head>
</head>
<body>
<p style = "padding-top: 15px; border:1px solid black;">
This is a paragraph with a specified top padding
</p>
<p style = "padding-top: 5%; border:1px solid black;">
This is another paragraph with a specified top padding in percent
</p>
</body>
</html>
It will produce the following result −
The padding-left Property :
• The padding-left property sets the left padding (space) of an element. This can take a value in terms of
length of %.
• Here is an example −
<html>
<head>
</head>
<body>
<p style = "padding-left: 15px; border:1px solid black;">
This is a paragraph with a specified left padding
</p>
<p style = "padding-left: 15%; border:1px solid black;">
This is another paragraph with a specified left padding in percent
</p>
</body>
</html>
It will produce the following result −
The padding-right Property :
• The padding-right property sets the right padding (space) of an element. This can take a value in terms of
length of %.
• Here is an example −
<html>
<head>
</head>
<body>
<p style = "padding-right: 15px; border:1px solid black;">
This is a paragraph with a specified right padding
</p>
<p style = "padding-right: 5%; border:1px solid black;">
This is another paragraph with a specified right padding in percent
</p>
</body>
</html>
It will produce the following result −
The Padding Property :
• The padding property sets the left, right, top and bottom padding (space) of an element. This can
take a value in terms of length of %.
• Here is an example −
<html>
<head>
</head>
<body>
<p style = "padding: 15px; border:1px solid black;">
all four padding will be 15px
</p>
<p style = "padding:10px 2%; border:1px solid black;">
top and bottom padding will be 10px, left and right
padding will be 2% of the total width of the document.
</p>
<p style = "padding: 10px 2% 10px; border:1px solid black;">
top padding will be 10px, left and right padding will
be 2% of the total width of the document, bottom padding will be 10px
</p>
<p style = "padding: 10px 2% 10px 10px; border:1px solid black;">
top padding will be 10px, right padding will be 2% of
the total width of the document, bottom padding and top padding will be 10px
</p>
</body>
</html>
It will produce the following result :

More Related Content

PPTX
HTML Fundamentals
PPTX
PPT
CSS Basics
PPT
Introduction to CSS Borders - Lesson 4
PPSX
Html introduction
PPTX
What is css
PPT
JavaScript & Dom Manipulation
HTML Fundamentals
CSS Basics
Introduction to CSS Borders - Lesson 4
Html introduction
What is css
JavaScript & Dom Manipulation

What's hot (20)

PPTX
Flex box
PPTX
Html and css
PPTX
html-table
PPTX
Css backgrounds
PDF
Background property in css
PPTX
HTML Forms
PPT
How Cascading Style Sheets (CSS) Works
PDF
CSS Day: CSS Grid Layout
PPTX
CSS - Text Properties
PDF
Introduction to CSS3
PPT
CSS for Beginners
PPTX
Css margins
PPSX
Javascript variables and datatypes
PDF
Introduction to php
PDF
Basic-CSS-tutorial
PPT
JavaScript Control Statements I
PPTX
Cascading style sheet
PPT
cascading style sheet ppt
PPTX
Bootstrap PPT Part - 2
PPTX
Links in Html
Flex box
Html and css
html-table
Css backgrounds
Background property in css
HTML Forms
How Cascading Style Sheets (CSS) Works
CSS Day: CSS Grid Layout
CSS - Text Properties
Introduction to CSS3
CSS for Beginners
Css margins
Javascript variables and datatypes
Introduction to php
Basic-CSS-tutorial
JavaScript Control Statements I
Cascading style sheet
cascading style sheet ppt
Bootstrap PPT Part - 2
Links in Html
Ad

Similar to Css padding (20)

PPTX
Css margins
PPTX
Web Engineering - Basic CSS Properties
PDF
Web Design Course: CSS lecture 4
PDF
Web Layout
PDF
Quarter 3_Lesson_One_CSSheets_Paddings.pdf
DOCX
INTERNET PROGRAMMING UNIT I REMAINING -SECOND HALF.docx
PPTX
Web Programming-css.pptx
PPTX
PPTX
Web Dev Essential 1web dev using HTML DHTML.pptx
PPTX
CSS Cascade Style Sheet
PPT
Lecture5.ppt C style sheet notes for B.CA and BIT
PPTX
Css dimension
PPT
Cascading Style Sheets By Mukesh
PDF
Pemrograman Web 2 - CSS
PPTX
Css presentation lecture 4
PDF
5. Web Technology CSS Advanced
PDF
TUTORIAL DE CSS 2.0
PPTX
CSS tutorial chapter 3
PPTX
Supercharged HTML & CSS
PPTX
Intro to WebSite Development ( Text properties and margins )
Css margins
Web Engineering - Basic CSS Properties
Web Design Course: CSS lecture 4
Web Layout
Quarter 3_Lesson_One_CSSheets_Paddings.pdf
INTERNET PROGRAMMING UNIT I REMAINING -SECOND HALF.docx
Web Programming-css.pptx
Web Dev Essential 1web dev using HTML DHTML.pptx
CSS Cascade Style Sheet
Lecture5.ppt C style sheet notes for B.CA and BIT
Css dimension
Cascading Style Sheets By Mukesh
Pemrograman Web 2 - CSS
Css presentation lecture 4
5. Web Technology CSS Advanced
TUTORIAL DE CSS 2.0
CSS tutorial chapter 3
Supercharged HTML & CSS
Intro to WebSite Development ( Text properties and margins )
Ad

More from AbhishekMondal42 (20)

PPTX
Oss evaluation-certification-oss-financial-advantages
PPTX
Word press 01
PPTX
Word press posts(preview &amp; publish)
PPTX
Word press posts(add , edit , delete post)
PPTX
Word press pages(edit and delete)
PPTX
Word press pages(add)
PPTX
Word press media(add,insert,delete)
PPTX
Word press media library
PPTX
Word press widget management
PPTX
Word press view plugins
PPTX
Word press user roles
PPTX
Word press theme management
PPTX
Word press personal profile
PPTX
Word press moderate comments
PPTX
Word press install plugins
PPTX
Word press edit users
PPTX
Word press edit tags
PPTX
Word press edit links
PPTX
Word press edit comments
PPTX
Word press delete users
Oss evaluation-certification-oss-financial-advantages
Word press 01
Word press posts(preview &amp; publish)
Word press posts(add , edit , delete post)
Word press pages(edit and delete)
Word press pages(add)
Word press media(add,insert,delete)
Word press media library
Word press widget management
Word press view plugins
Word press user roles
Word press theme management
Word press personal profile
Word press moderate comments
Word press install plugins
Word press edit users
Word press edit tags
Word press edit links
Word press edit comments
Word press delete users

Recently uploaded (20)

PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Classroom Observation Tools for Teachers
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Pre independence Education in Inndia.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Cell Structure & Organelles in detailed.
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Computing-Curriculum for Schools in Ghana
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Renaissance Architecture: A Journey from Faith to Humanism
Classroom Observation Tools for Teachers
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Pre independence Education in Inndia.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
human mycosis Human fungal infections are called human mycosis..pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Cell Structure & Organelles in detailed.
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPH.pptx obstetrics and gynecology in nursing
STATICS OF THE RIGID BODIES Hibbelers.pdf
Complications of Minimal Access Surgery at WLH
Computing-Curriculum for Schools in Ghana
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Microbial disease of the cardiovascular and lymphatic systems
O7-L3 Supply Chain Operations - ICLT Program
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...

Css padding

  • 2. CSS - Padding The padding property allows you to specify how much space should appear between the content of an element and its border − The value of this attribute should be either a length, a percentage, or the word inherit. If the value is inherit, it will have the same padding as its parent element. If a percentage is used, the percentage is of the containing box. The following CSS properties can be used to control lists. You can also set different values for the padding on each side of the box using the following properties − • The padding-bottom specifies the bottom padding of an element. • The padding-top specifies the top padding of an element. • The padding-left specifies the left padding of an element. • The padding-right specifies the right padding of an element. • The padding serves as shorthand for the preceding properties.
  • 3. The padding-bottom Property : • The padding-bottom property sets the bottom padding (space) of an element. This can take a value in terms of length of %. • Here is an example − <html> <head> </head> <body> <p style = "padding-bottom: 15px; border:1px solid black;"> This is a paragraph with a specified bottom padding </p> <p style = "padding-bottom: 5%; border:1px solid black;"> This is another paragraph with a specified bottom padding in percent </p> </body> </html>
  • 4. It will produce the following result −
  • 5. The padding-top Property : • The padding-top property sets the top padding (space) of an element. This can take a value in terms of length of %. • Here is an example − <html> <head> </head> <body> <p style = "padding-top: 15px; border:1px solid black;"> This is a paragraph with a specified top padding </p> <p style = "padding-top: 5%; border:1px solid black;"> This is another paragraph with a specified top padding in percent </p> </body> </html>
  • 6. It will produce the following result −
  • 7. The padding-left Property : • The padding-left property sets the left padding (space) of an element. This can take a value in terms of length of %. • Here is an example − <html> <head> </head> <body> <p style = "padding-left: 15px; border:1px solid black;"> This is a paragraph with a specified left padding </p> <p style = "padding-left: 15%; border:1px solid black;"> This is another paragraph with a specified left padding in percent </p> </body> </html>
  • 8. It will produce the following result −
  • 9. The padding-right Property : • The padding-right property sets the right padding (space) of an element. This can take a value in terms of length of %. • Here is an example − <html> <head> </head> <body> <p style = "padding-right: 15px; border:1px solid black;"> This is a paragraph with a specified right padding </p> <p style = "padding-right: 5%; border:1px solid black;"> This is another paragraph with a specified right padding in percent </p> </body> </html>
  • 10. It will produce the following result −
  • 11. The Padding Property : • The padding property sets the left, right, top and bottom padding (space) of an element. This can take a value in terms of length of %. • Here is an example − <html> <head> </head> <body> <p style = "padding: 15px; border:1px solid black;"> all four padding will be 15px </p> <p style = "padding:10px 2%; border:1px solid black;"> top and bottom padding will be 10px, left and right padding will be 2% of the total width of the document. </p> <p style = "padding: 10px 2% 10px; border:1px solid black;"> top padding will be 10px, left and right padding will be 2% of the total width of the document, bottom padding will be 10px </p>
  • 12. <p style = "padding: 10px 2% 10px 10px; border:1px solid black;"> top padding will be 10px, right padding will be 2% of the total width of the document, bottom padding and top padding will be 10px </p> </body> </html> It will produce the following result :