Tillitsdone
down Scroll to discover

Understanding CSS padding-block-end for Better Web Design

Learn about the CSS padding-block-end property, which controls the padding at the logical end of a block element.

Use cases include responsive designs and varied text orientations.

Options available are length, percentage, and global CSS values.
thumbnail

Introduction

The padding-block-end property in CSS is a handy tool for web developers and designers. It lets you set the padding at the logical end of a block element, which can change based on the text’s direction and writing mode. This property became widely available in September 2021 and helps create flexible and responsive layouts, especially for multilingual sites.

Specification

The padding-block-end property is part of the CSS Logical Properties and Values Level 1 specification. This specification helps create more adaptable designs, especially in environments with different text orientations and writing modes.

Description

The padding-block-end property in CSS defines the padding at the logical end of a block element. Unlike traditional padding properties that use physical directions, padding-block-end adapts to the flow of text and layout. This makes it perfect for responsive and adaptable designs.

Syntax

padding-block-end: <length> | <percentage> | inherit | initial | revert | revert-layer | unset;
  • <length>: A fixed length value, like px (pixels) or em (relative to text size).
  • <percentage>: A percentage of the inline size of the containing block.
  • Global values: Common CSS values like inherit, initial, revert, revert-layer, and unset.

Values

  • <length>: A fixed length value (e.g., 10px, 1em).
  • <percentage>: A percentage of the inline size of the containing block (e.g., 5%).
  • Global values: inherit, initial, revert, revert-layer, unset.

Formal Definition

  • Initial Value: 0
  • Applies To: All elements except table-related elements
  • Inherited: No
  • Percentages: Relative to the logical width of the containing block
  • Computed Value: As a <length>
  • Animation Type: A length

Examples

Example 1: Setting Block End Padding for Horizontal Text

HTML:

<!DOCTYPE html>
<html>
<head>
<title>CSS | padding-block-end Property</title>
<style>
h1 {
color: green;
}
div {
background-color: yellow;
width: 110px;
height: 80px;
}
.example {
padding-block-end: 20px;
background-color: purple;
}
</style>
</head>
<body>
<center>
<h1>Website</h1>
<b>CSS | padding-block-end Property</b>
<br><br>
<div class="example">Example Text</div>
</center>
</body>
</html>

Example 2: Setting Block End Padding for Vertical Text

HTML:

<!DOCTYPE html>
<html>
<head>
<title>CSS | padding-block-end Property</title>
<style>
h1 {
color: green;
}
div {
background-color: yellow;
width: 110px;
height: 80px;
}
.example {
padding-block-end: 20px;
writing-mode: vertical-lr;
background-color: purple;
}
</style>
</head>
<body>
<center>
<h1>Website</h1>
<b>CSS | padding-block-end Property</b>
<br><br>
<div class="example">Example Text</div>
</center>
</body>
</html>

Browser Compatibility

The padding-block-end property is supported by:

  • Google Chrome 87
  • Edge 87
  • Firefox 41
  • Opera 73
  • Safari 12.1

See Also

For more information, check out:

  • [CSS Logical Properties and Values]WebsiteUrl
  • Mapped physical properties: [padding-top]WebsiteUrl, [padding-right]WebsiteUrl, [padding-bottom]WebsiteUrl, [padding-left]WebsiteUrl
  • Related properties: [writing-mode]WebsiteUrl, [direction]WebsiteUrl, [text-orientation]WebsiteUrl

Supported Browsers

The padding-block-end property is supported by:

  • Google Chrome 87
  • Edge 87
  • Firefox 41
  • Opera 73
  • Safari 12.1

This wide compatibility ensures that your designs will work consistently across various platforms and devices, providing a seamless user experience. By using padding-block-end, you can create more flexible and adaptable web designs that cater to different text orientations and writing modes.

For the most up-to-date information on browser compatibility, you can refer to the [Browser Compatibility Data (BCD)]WebsiteUrl on MDN Web Docs. This resource provides detailed compatibility tables and allows you to verify the support for padding-block-end across different browser versions.

By leveraging the padding-block-end property, you can enhance the overall user experience and make your web content more accessible and visually appealing.

icons/css-4.svg CSS Blogs
CSS3 is the latest version of Cascading Style Sheets, offering advanced styling features like animations, transitions, shadows, gradients, and responsive design.
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
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
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.