- Services
- Case Studies
- Technologies
- NextJs development
- Flutter development
- NodeJs development
- ReactJs development
- About
- Contact
- Tools
- Blogs
- FAQ
CSS Padding-Inline Flexible Text Padding
Learn use cases, syntax, and options for this versatile CSS property.
Optimize your web design.
Introduction
The padding-inline CSS property sets the padding at the start and end of an element’s inline direction. It’s useful for creating flexible designs that adapt to different text directions and writing modes. This property has been widely supported since September 2021.
Specification
The padding-inline property is part of the CSS Logical Properties and Values Level 1 specification. You can find more details in the official documentation:
Description
The padding-inline property lets you set the padding at the start and end of an element’s inline direction. This is handy for making designs that adapt to the text’s writing mode, direction, and orientation. It’s a shorthand for padding-inline-start and padding-inline-end.
Syntax
You can use one or two values with padding-inline:
/* One value */padding-inline: 10px;
/* Two values */padding-inline: 10px 20px;- One value: Applies the same padding to both the start and end.
- Two values: The first value is for the start, and the second is for the end.
Values
The padding-inline property accepts the following values:
<length>: Fixed value (e.g.,10px,1em).<percentage>: Relative to the inline size of the containing block (e.g.,5%).- Global values:
inherit,initial,revert,revert-layer,unset.
Constituent Properties
The padding-inline property combines two properties:
padding-inline-start: Padding at the start of the inline direction.padding-inline-end: Padding at the end of the inline direction.
Using padding-inline, you can set both properties at once:
padding-inline: 10px 20px;Examples
Horizontal Text
HTML:
<div> <p class="exampleText">Example text</p></div>CSS:
div { background-color: yellow; width: 120px; height: 120px;}
.exampleText { padding-inline: 20px 40px; background-color: #c8c800;}Vertical Text
HTML:
<div> <p class="exampleText">Example text</p></div>CSS:
div { background-color: yellow; width: 120px; height: 120px;}
.exampleText { writing-mode: vertical-rl; padding-inline: 20px 40px; background-color: #c8c800;}Using Percentage Values
HTML:
<div> <p class="exampleText">Example text</p></div>CSS:
div { background-color: yellow; width: 120px; height: 120px;}
.exampleText { padding-inline: 5% 10%; background-color: #c8c800;}Using a Single Value
HTML:
<div> <p class="exampleText">Example text</p></div>CSS:
div { background-color: yellow; width: 120px; height: 120px;}
.exampleText { padding-inline: 20px; background-color: #c8c800;}Browser Compatibility
The padding-inline property is supported in most modern browsers:
- Google Chrome: Version 87 and later
- Microsoft Edge: Version 87 and later
- Mozilla Firefox: Version 66 and later
- Opera: Version 73 and later
- Safari: Version 14.1 and later
For the most up-to-date information, check the MDN documentation:
See Also
For more information, you might find these topics useful:
- CSS Logical Properties and Values: Learn more about logical properties.
- Mapped Physical Properties: Understand the physical padding properties.
- Writing Mode, Direction, and Text Orientation: Learn about properties that define text direction.
สร้างเว็บไซต์ 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 เลือกวิธีที่เหมาะกับความต้องการของคุณ พร้อมเปรียบเทียบ เพื่อการพัฒนาที่มีประสิทธิภาพ! Talk with CEO
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.