batatop
batatop

Reputation: 1099

React adding different padding values to different sides with the "padding" property

Is it possible to add different padding values to different sides on React? I know the padding-top, padding-bottom etc. properties but I'm trying to find a way to add them with a single line just like in CSS such as:

padding: "10px 7px 10px 7px"

Thank you for your concern.

Upvotes: 3

Views: 7695

Answers (1)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85653

Setting padding should work fine. However, you may also use paddingVertical and paddingHorizontal to set padding top to bottom and left to right correspondingly.

All of the following give you the same result:

style={{padding: '10px 7px 10px 7px'}}
style={{padding: '10px 7px'}}
style={{paddingVertical: '10px', paddingHorizontal: '7px'}}

Upvotes: 5

Related Questions