La propietat CSS padding-left
estableix l'amplada de l'àrea de farcit a la part esquerra d'un element. A diferència dels marges, no es permeten valors negatius per al farcit. La propietat abreujada padding
es pot utilitzar per establir farcits als quatre costats d'un element amb una sola declaració.
/* <length> values */
padding-left: 0.5em;
padding-left: 0;
padding-left: 2cm;
/* <percentage> value */
padding-left: 10%;
/* Global values */
padding-left: inherit;
padding-left: initial;
padding-left: unset;
L'àrea de farcit d'un element és l'espai entre el seu contingut i la seva vora.
Initial value | 0 |
---|---|
Applies to | all elements, except table-row-group , table-header-group , table-footer-group , table-row , table-column-group and table-column . It also applies to ::first-letter . |
Inherited | no |
Percentages | refer to the width of the containing block |
Media | visual |
Computed value | the percentage as specified or the absolute length |
Animation type | a length |
Canonical order | the unique non-ambiguous order defined by the formal grammar |
Sintaxi
Valors
length
- La grandària del farcit com a valor fix. Ha de ser no negatiu.
percentage
- La grandària del farcit com a percentatge, en relació amb l'amplada del bloc contenidor. Ha de ser no negatiu.
Sintaxi formal
Exemples
.content { padding-left: 5%; }
.sidebox { padding-left: 10px; }
Especificacions
Especificació | Estat | Comentari |
---|---|---|
CSS Basic Box Model The definition of 'padding-left' in that specification. |
Working Draft | No hi ha cap canvi. |
CSS Transitions The definition of 'padding-left' in that specification. |
Working Draft | Defineix padding-left como animable. |
CSS Level 2 (Revision 1) The definition of 'padding-left' in that specification. |
Recommendation | No hi ha cap canvi. |
CSS Level 1 The definition of 'padding-left' in that specification. |
Recommendation | Definició inicial. |
Navegadors compatibles
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Descripció | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Suport bàsic | 1.0 | (Yes) | 1.0 (1.0) | 4.0 | 3.5 | 1.0 (85) |
Descripció | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Suport bàsic | ? | (Yes) | ? | ? | ? | ? |
Vegeu també
- Model de caixa CSSl
- La propietat abreujada
padding
es pot utilitzar per establir el farcit en els quatre costats d'un element amb una sola declaració:padding-top
,padding-right
,padding-bottom
ipadding-left
.