CSS - padding-inline-start Property



The CSS property padding-inline-start determines the logical inline start padding of an element. It maps to the physical padding properties that depend upon the writing mode, direction and text orientation of the element.

Possible Values

The CSS property padding-inline-start can be specified with one of the following values:

  • <length> − Determines the size of the padding as a fixed value. Negative value is not allowed.

  • <percentage> − Determines the size of the padding as a percentage, that is relative to the inline size of containing inline. Negative value is not allowed.

The values specified for the property corresponds to the padding-bottom, padding-left or padding-right properties based on the values of writing mode, direction and text orientation of the element.

It relates to the other padding CSS properties such as padding-block-start, padding-block-end, and padding-inline-end.

Applies To

All HTML elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column.

Syntax

padding-inline-start = <'padding-top'>

/* <length> values */
padding-inline-start: 10px;
padding-inline-start: 1em; 

/* <percentage> values */
padding-inline-start: 5%;

CSS padding-inline-start - Length Value

The following example demonstrates the use of padding-inline-start property with length value, which determines the inline start padding of the element.

<html>
<head>
<style>
   div {
      background-color: purple;
      width: 250px;
      height: 180px;
      position: relative;
   }

   .padding-ex {
      margin: 10px;
      position: absolute;
      padding-inline-start: 55px;
      background-color: pink;
   }
</style>
</head>
<body>
   <div>
      <span class="padding-ex">padding-inline-start</span>
   </div>
</body>
</html>

CSS padding-inline-start - Percentage Value

The following example demonstrates the use of padding-inline-start property with a percentage value, which determines the inline start padding of the element.

<html>
<head>
<style>
   div {
      background-color: purple;
      width: 250px;
      height: 180px;
      position: relative;
   }

   .padding-ex {
      margin: 10px;
      position: absolute;
      padding-inline-start: 35%;
      background-color: pink;
   }
</style>
</head>
<body>
   <div>
      <span class="padding-ex">padding-inline-start</span>
   </div>
</body>
</html>

CSS padding-inline - Writing Mode Vertical

The following example demonstrates the use of padding-inline-start property with a length value and writing mode as vertical-lr, which determines the inline start padding of the element.

<html>
<head>
<style>
   div {
      background-color: purple;
      width: 250px;
      height: 180px;
   }

   .padding-ex {
      margin: 10px;
      writing-mode: vertical-lr;
      padding-inline-start: 2.2em;
      background-color: pink;
   }
</style>
</head>
<body>
   <div>
      <span class="padding-ex">padding-inline-start</span>
   </div>
</body>
</html>
Advertisements