- Services
- Case Studies
- Technologies
- NextJs development
- Flutter development
- NodeJs development
- ReactJs development
- About
- Contact
- Tools
- Blogs
- FAQ
Understanding CSS padding-inline-start for Responsive Design
Explore its use cases, available options, and compatibility.
Introduction
The padding-inline-start CSS property adds padding to the start of an element’s inline axis, adapting to different writing modes and text orientations. This makes your designs more flexible and responsive.
Description
The padding-inline-start property defines the padding at the logical start of an element’s inline axis. Unlike traditional padding properties, it adapts to different writing modes, directions, and text orientations.
In a left-to-right language like English, padding-inline-start is equivalent to padding-left. In a right-to-left language like Arabic, it’s equivalent to padding-right. This property works with other logical padding properties to provide comprehensive control over an element’s padding.
Syntax
The padding-inline-start property is easy to use. Here’s the basic syntax:
padding-inline-start: value;The value can be:
- Length values: Absolute (
px) or relative (em). - Percentage value: Relative to the width of the containing block.
- Global values: Inheritance and reset values (
inherit,initial,revert,revert-layer,unset).
Values
The padding-inline-start property can take several types of values:
Length Values
- Absolute Lengths:
padding-inline-start: 10px; /* Absolute length */
- Relative Lengths:
padding-inline-start: 1em; /* Relative length */
Percentage Value
padding-inline-start: 5%; /* Relative to the block container's width */Global Values
- Inherit: Inherits the value from the parent element.
padding-inline-start: inherit;
- Initial: Resets to the default value.
padding-inline-start: initial;
- Revert: Reverts to the user agent stylesheet value.
padding-inline-start: revert;
- Revert-layer: Reverts to the value defined in the previous layer.
padding-inline-start: revert-layer;
- Unset: Resets to the inherited value if inheritable, otherwise to the initial value.
padding-inline-start: unset;
Formal Definition
- Initial Value:
0 - Applies To: All elements except certain table-related elements.
- Inherited: No
- Percentages: Refers to the logical width of the containing block.
- Computed Value: As
<length> - Animation Type: A length
Formal Syntax
padding-inline-start = [<'padding-top'>]
<padding-top> = <length-percentage [0,∞]>
<length-percentage> = <length> | <percentage>Examples
Basic Usage
HTML:
<div class="example"> <p class="exampleText">Example text</p></div>CSS:
div { background-color: yellow; width: 200px; height: 100px;}
.exampleText { padding-inline-start: 20px; background-color: #c8c800;}Result: The text will have a 20px padding at the start of its inline axis.
Vertical Text
HTML:
<div> <p class="exampleText">Example text</p></div>CSS:
div { background-color: yellow; width: 120px; height: 120px;}
.exampleText { writing-mode: vertical-lr; padding-inline-start: 20px; background-color: #c8c800;}Result: The text will be displayed vertically with a 20px padding at the start of its inline axis.
Right-to-Left Language
HTML:
<div class="example"> <p class="exampleText" lang="ar">مثال نص</p></div>CSS:
div { background-color: yellow; width: 200px; height: 100px;}
.exampleText { padding-inline-start: 20px; background-color: #c8c800;}Result: The Arabic text will have a 20px padding at the start of its inline axis.
Specifications
The padding-inline-start property is defined in the CSS Logical Properties and Values Level 1 specification. This specification outlines how logical properties work with writing modes, directionality, and text orientation.
Specification Document:
- [CSS Logical Properties and Values Level 1]WebsiteUrl
Browser Compatibility
The padding-inline-start property is widely supported across modern browsers:
- Google Chrome: Supported since version 87.
- Microsoft Edge: Supported since version 87.
- Mozilla Firefox: Supported since version 41.
- Opera: Supported since version 73.
- Safari: Supported since version 12.1.
See Also
To learn more and explore related properties and concepts, check out:
-
CSS Logical Properties and Values: Discover how logical properties enhance web design flexibility.
- [CSS Logical Properties and Values]WebsiteUrl
-
Mapped Physical Properties: Understand how logical properties map to traditional physical properties:
- [
padding-top]WebsiteUrl - [
padding-right]WebsiteUrl - [
padding-bottom]WebsiteUrl - [
padding-left]WebsiteUrl
- [
-
Related CSS Properties: Explore other CSS properties that define writing modes, directionality, and text orientation:
- [
writing-mode]WebsiteUrl - [
direction]WebsiteUrl - [
text-orientation]WebsiteUrl
- [
สร้างเว็บไซต์ 1 เว็บ ต้องใช้งบเท่าไหร่? เจาะลึกทุกองค์ประกอบ website development cost อยากสร้างเว็บไซต์แต่ไม่มั่นใจในเรื่องของงบประมาณ อ่านสรุปเจาะลึกตั้งแต่ดีไซน์, ฟังก์ชัน และการดูแล พร้อมตัวอย่างงบจริงจาก Till it’s done ที่แผนชัด งบไม่บานปลายแน่นอน
Next.js สอน 14 ขั้นตอนเบื้องต้น: สร้างโปรเจกต์แรกใน 30 นาที เริ่มต้นกับ Next.js ใน 14 ขั้นตอนเพียงแค่ 30 นาที พร้อม SSR/SSG และ API Routes ด้วยตัวอย่างโค้ดง่าย ๆ อ่านต่อเพื่อสร้างโปรเจ็กต์แรกได้ทันทีที่นี่
วิธีสมัคร Apple Developer Account เพื่อนำแอปขึ้น App Store ทีละขั้นตอน อยากปล่อยแอปบน App Store ระดับโลก มาอ่านคู่มือสมัคร Apple Developer Account พร้อมเคล็ดลับ TestFlight และวิธีอัปโหลดที่ง่ายในบทความเดียวนี้ได้เลย
TypeScript Interface คืออะไร? อธิบายพร้อมวิธีใช้และข้อแตกต่างจาก Type เรียนรู้วิธีใช้ TypeScript Interface เพื่อสร้างโครงสร้างข้อมูลที่ปลอดภัยและเข้าใจง่าย พร้อมเปรียบเทียบข้อดีข้อแตกต่างกับ Type ที่คุณต้องรู้ ถูกรวมเอาไว้ในบทความนี้แล้ว
Material-UI (MUI) คืออะไร อยากสร้าง UI สวยงามและเป็นมืออาชีพในเวลาอันรวดเร็วใช่ไหม มาทำความรู้จักกับ Material-UI (MUI) ที่ช่วยให้คุณพัฒนาแอปพลิเคชันบน React ได้ง่ายและดูดีในทุกอุปกรณ์
เปรียบเทียบ 3 วิธีติดตั้ง install node js บน Ubuntu: NVM vs NodeSource vs Official Repo แบบไหนดีที่สุด? เรียนรู้วิธีติดตั้ง Node.js บน Ubuntu ด้วย NVM, NodeSource หรือ Official Repo เลือกวิธีที่เหมาะกับความต้องการของคุณ พร้อมเปรียบเทียบ เพื่อการพัฒนาที่มีประสิทธิภาพ! พูดคุยกับซีอีโอ
We'll be right here with you every step of the way.
We'll be here, prepared to commence this promising collaboration.
Whether you're curious about features, warranties, or shopping policies, we provide comprehensive answers to assist you.