Tillitsdone
down Scroll to discover

CSS padding-bottom Enhance Your Web Design Layout

CSS padding-bottom sets the space between an element's content and its bottom border.

Use pixels, percentages, or global values like inherit and initial for precise control.
thumbnail

Introduction

In web development and design, the padding-bottom CSS property is essential for controlling the layout and aesthetics of web pages. This property sets the height of the padding area at the bottom of an element, creating space between the element’s content and its border. By effectively using padding-bottom, you can significantly enhance the visual appeal and readability of your web designs.

Specification

The padding-bottom property is defined in the CSS Box Model Module Level 3, under the “padding-physical” section. This specification outlines how the padding properties should be implemented and used in web development.

Syntax

The padding-bottom property in CSS is straightforward to use. It allows you to specify the height of the padding area at the bottom of an element. Here’s the basic syntax:

padding-bottom: value;

Supported Values

The padding-bottom property can accept several types of values:

  1. Length Values: Such as pixels (px), ems (em), centimeters (cm), etc.
    padding-bottom: 10px;
    padding-bottom: 2em;
    padding-bottom: 1cm;
  2. Percentage Values: Relative to the width of the containing block.
    padding-bottom: 10%;
  3. Global Values: Such as inherit, initial, revert, revert-layer, and unset.
    padding-bottom: inherit;
    padding-bottom: initial;
    padding-bottom: revert;
    padding-bottom: revert-layer;
    padding-bottom: unset;

Rules and Constraints

  • Non-negative Values: Padding values must be non-negative.
  • Default Value: The default value for padding-bottom is 0.

Example Syntax

Here’s an example of how to use the padding-bottom property in your CSS:

.content {
padding-bottom: 20px;
}
.sidebox {
padding-bottom: 5%;
}

Examples

To better understand how the padding-bottom property works, let’s explore some practical examples.

Example 1: Setting Padding Bottom with Pixels

In this example, we’ll use a fixed length value (pixels) to set the padding-bottom property.

HTML:

<!DOCTYPE html>
<html>
<head>
<title>CSS padding-bottom Property</title>
<style>
.content {
padding-bottom: 35px;
color: white;
background: green;
}
</style>
</head>
<body style="text-align: center;">
<h1 style="color: green;">Website</h1>
<h2>padding-bottom Property</h2>
<p class="content">
This paragraph has a padding-bottom of 35px.
</p>
</body>
</html>

Output: This paragraph has a padding-bottom of 35px.

Example 2: Setting Padding Bottom with Percentages

In this example, we’ll use a percentage value to set the padding-bottom property.

HTML:

<!DOCTYPE html>
<html>
<head>
<title>CSS padding-bottom Property</title>
<style>
.content {
padding-bottom: 10%;
color: white;
background: green;
}
</style>
</head>
<body style="text-align: center;">
<h1 style="color: green;">Website</h1>
<h2>padding-bottom Property</h2>
<p class="content">
This paragraph has a padding-bottom of 10%.
</p>
</body>
</html>

Output: This paragraph has a padding-bottom of 10%.

Example 3: Using Global Values

In this example, we’ll demonstrate how to use global values like inherit and initial to set the padding-bottom property.

HTML:

<!DOCTYPE html>
<html>
<head>
<title>CSS padding-bottom Property</title>
<style>
.parent {
padding-bottom: 20px;
}
.child {
padding-bottom: inherit;
color: white;
background: green;
}
.reset {
padding-bottom: initial;
color: white;
background: blue;
}
</style>
</head>
<body style="text-align: center;">
<h1 style="color: green;">Website</h1>
<h2>padding-bottom Property</h2>
<div class="parent">
<p class="child">
This paragraph inherits a padding-bottom of 20px from its parent.
</p>
<p class="reset">
This paragraph resets the padding-bottom to its initial value (0).
</p>
</div>
</body>
</html>

Output: This paragraph inherits a padding-bottom of 20px from its parent. This paragraph resets the padding-bottom to its initial value (0).

Browser Compatibility

The padding-bottom property is widely supported across all major web browsers, ensuring that your web designs remain consistent and functional regardless of the platform or device used by your visitors.

Supported Browsers

  • Google Chrome: Supported since version 1.0.
  • Microsoft Edge: Supported since version 12.0.
  • Internet Explorer: Supported since version 4.0.
  • Mozilla Firefox: Supported since version 1.0.
  • Opera: Supported since version 3.5.
  • Apple Safari: Supported since version 1.0.

Compatibility Table

BrowserMinimum Version
Google Chrome1.0
Microsoft Edge12.0
Internet Explorer4.0
Mozilla Firefox1.0
Opera3.5
Apple Safari1.0

Notes on Compatibility

  • Cross-Browser Consistency: The padding-bottom property behaves consistently across all supported browsers.
  • Legacy Support: The widespread support for padding-bottom means that even older browsers can correctly render your web pages.
  • Future-Proofing: Given its long-standing support, the padding-bottom property is a reliable choice for both current and future web development projects.

FAQs

What is the padding-bottom property in CSS?

The padding-bottom property in CSS sets the amount of space between the content of an element and its bottom edge. It adds extra space inside the element, increasing the distance between the content and the element’s border.

How can I set a 20px padding at the bottom of an element?

To set a 20px padding at the bottom of an element, use the following CSS:

padding-bottom: 20px;

Does padding-bottom affect the width of an element?

No, padding-bottom does not affect the width of an element. It only impacts the vertical space inside the element at the bottom edge.

How does padding-bottom interact with margin-bottom?

The padding-bottom property adds space inside the element, while the margin-bottom property adds space outside the element. They can be used together to control both internal and external spacing of an element.

Can padding-bottom be set in percentages?

Yes, you can set padding-bottom in percentages. The percentage is based on the width of the containing block, not the height. For example:

padding-bottom: 10%;

What are the global values for padding-bottom?

The global values for padding-bottom include:

  • inherit: Takes the value from the parent element.
  • initial: Resets to the default value (0).
  • revert: Resets to the browser’s default value.
  • revert-layer: Resets considering CSS cascade layers.
  • unset: Resets to the natural value, either initial or inherit.

Can negative values be used for padding-bottom?

No, you cannot use negative values for padding-bottom. It must be non-negative.

What is the default value for padding-bottom?

The default value for padding-bottom is 0.

icons/logo-tid.svg Latest Blogs
Discover our top articles, selected to support the growth of your business.
https://imgproxy-landing-page.tillitsdone.com/sig/rs:fit:1200:630/plain/https%3A%2F%2Fcms-r2.tillitsdone.com%2Fwp-content-prod%2Fuploads%2F2025%2F10%2FTill-its-done_SEO_R42_Sep_1440x697.jpg@webp Next.js สอน 14 ขั้นตอนเบื้องต้น: สร้างโปรเจกต์แรกใน 30 นาที เริ่มต้นกับ Next.js ใน 14 ขั้นตอนเพียงแค่ 30 นาที พร้อม SSR/SSG และ API Routes ด้วยตัวอย่างโค้ดง่าย ๆ อ่านต่อเพื่อสร้างโปรเจ็กต์แรกได้ทันทีที่นี่ https://imgproxy-landing-page.tillitsdone.com/sig/rs:fit:1200:630/plain/https%3A%2F%2Fcms-r2.tillitsdone.com%2Fwp-content-prod%2Fuploads%2F2025%2F10%2FTill-its-done_SEO_R41_Sep_1440x697.jpg@webp วิธีสมัคร Apple Developer Account เพื่อนำแอปขึ้น App Store ทีละขั้นตอน อยากปล่อยแอปบน App Store ระดับโลก มาอ่านคู่มือสมัคร Apple Developer Account พร้อมเคล็ดลับ TestFlight และวิธีอัปโหลดที่ง่ายในบทความเดียวนี้ได้เลย https://imgproxy-landing-page.tillitsdone.com/sig/rs:fit:1200:630/plain/https%3A%2F%2Fcms-r2.tillitsdone.com%2Fwp-content-prod%2Fuploads%2F2025%2F10%2FTill-its-done_SEO_R40_Sep_1440x697.jpg@webp Web Development Tools ที่ต้องมีติดเครื่อง ครบทุกสายงาน Frontend, Backend, DevOps รวมเครื่องมือพัฒนาเว็บครบทุกสายงาน ไม่ว่าจะเป็น Frontend, Backend หรือ DevOps ที่จะพาคุณลุยโปรเจ็กต์ได้ลื่นขึ้นในทุกขั้น https://imgproxy-landing-page.tillitsdone.com/sig/rs:fit:1200:630/plain/https%3A%2F%2Fcms-r2.tillitsdone.com%2Fwp-content-prod%2Fuploads%2F2025%2F10%2FTill-its-done_SEO_R38_Sep_1440x697.jpg@webp TypeScript Interface คืออะไร? อธิบายพร้อมวิธีใช้และข้อแตกต่างจาก Type เรียนรู้วิธีใช้ TypeScript Interface เพื่อสร้างโครงสร้างข้อมูลที่ปลอดภัยและเข้าใจง่าย พร้อมเปรียบเทียบข้อดีข้อแตกต่างกับ Type ที่คุณต้องรู้ ถูกรวมเอาไว้ในบทความนี้แล้ว https://imgproxy-landing-page.tillitsdone.com/sig/rs:fit:1200:630/plain/https%3A%2F%2Fcms-r2.tillitsdone.com%2Fwp-content-prod%2Fuploads%2F2025%2F09%2FTill-its-done_SEO_R36_Sep_1440x697.jpg@webp Material-UI (MUI) คืออะไร อยากสร้าง UI สวยงามและเป็นมืออาชีพในเวลาอันรวดเร็วใช่ไหม มาทำความรู้จักกับ Material-UI (MUI) ที่ช่วยให้คุณพัฒนาแอปพลิเคชันบน React ได้ง่ายและดูดีในทุกอุปกรณ์ https://imgproxy-landing-page.tillitsdone.com/sig/rs:fit:1200:630/plain/https%3A%2F%2Fcms-r2.tillitsdone.com%2Fwp-content-prod%2Fuploads%2F2025%2F09%2FTill-its-done_SEO_R27_Sep_1440x697.jpg@webp เปรียบเทียบ 3 วิธีติดตั้ง install node js บน Ubuntu: NVM vs NodeSource vs Official Repo แบบไหนดีที่สุด? เรียนรู้วิธีติดตั้ง Node.js บน Ubuntu ด้วย NVM, NodeSource หรือ Official Repo เลือกวิธีที่เหมาะกับความต้องการของคุณ พร้อมเปรียบเทียบ เพื่อการพัฒนาที่มีประสิทธิภาพ!
icons/logo-tid.svg

Talk with CEO

Ready to bring your web/app to life or boost your team with expert Thai developers?
Contact us today to discuss your needs, and let’s create tailored solutions to achieve your goals. We’re here to help at every step!
🖐️ Contact us
down Explore our best articles, cover a wide variety of technologies
Our knowledge base
196 Articles
Explore right
icons/logo-react.svg ReactJs
Popular JavaScript library for building user interfaces with a component-based architecture.
160 Articles
Explore right
icons/flutter.svg Flutter
UI toolkit for building natively compiled applications for mobile, web, and desktop from a single codebase.
144 Articles
Explore right
icons/logo-nodejs.svg Nodejs
JavaScript runtime for building scalable, high-performance server-side applications.
58 Articles
Explore right
icons/next-js.svg Nextjs
React framework enabling server-side rendering and static site generation for optimized performance.
38 Articles
Explore right
icons/tailwind.svg TailwindCSS
Utility-first CSS framework for rapid UI development.
36 Articles
Explore right
icons/code-outline.svg Typescript
Superset of JavaScript adding static types for improved code quality and maintainability.
126 Articles
Explore right
icons/code-outline.svg Golang
Programming language known for its simplicity, concurrency model, and performance.
67 Articles
Explore right
icons/code-outline.svg AstroJs
Astro is an all-in-one web framework. It includes everything you need to create a website, built-in.
38 Articles
Explore right
icons/code-outline.svg Jest
Versatile testing framework for JavaScript applications supporting various test types.
15 Articles
Explore right
icons/code-outline.svg Website development th
11 Articles
Explore right
icons/code-outline.svg Mobile application th
5 Articles
Explore right
icons/code-outline.svg Reactjs th
4 Articles
Explore right
icons/code-outline.svg Nextjs th
3 Articles
Explore right
icons/code-outline.svg Flutter th
1 Articles
Explore right
icons/code-outline.svg Software house th
1 Articles
Explore right
icons/code-outline.svg Nodejs th
1 Articles
Explore right
icons/code-outline.svg Typescript th
337 Articles
Explore right
icons/css-4.svg CSS
CSS3 is the latest version of Cascading Style Sheets, offering advanced styling features like animations, transitions, shadows, gradients, and responsive design.
Let's keep in Touch
Thank you for your interest in Tillitsdone! Whether you have a question about our services, want to discuss a potential project, or simply want to say hello, we're here and ready to assist you.
We'll be right here with you every step of the way.
Contact Information
rick@tillitsdone.com+66824564755
Find All the Ways to Get in Touch with Tillitsdone - We're Just a Click, Call, or Message Away. We'll Be Right Here, Ready to Respond and Start a Conversation About Your Needs.
Address
9 Phahonyothin Rd, Khlong Nueng, Khlong Luang District, Pathum Thani, Bangkok Thailand
Visit Tillitsdone at Our Physical Location - We'd Love to Welcome You to Our Creative Space. We'll Be Right Here, Ready to Show You Around and Discuss Your Ideas in Person.
Social media
FacebookInstagramLinkedIn
Connect with Tillitsdone on Various Social Platforms - Stay Updated and Engage with Our Latest Projects and Insights. We'll Be Right Here, Sharing Our Journey and Ready to Interact with You.
We anticipate your communication and look forward to discussing how we can contribute to your business's success.
We'll be here, prepared to commence this promising collaboration.
Frequently Asked Questions
Explore frequently asked questions about our products and services.
Whether you're curious about features, warranties, or shopping policies, we provide comprehensive answers to assist you.