Вопрос:

Cannot set padding to 0 on Material UI Button

reactjs material-ui

2206 просмотра

1 ответ

2485 Репутация автора

I'm using a normal Button from Material-UI for React tried adding the following style

button: {
    display: 'inline-block',
    padding:0
  }

to this button

<Button className={classes.button}> I'm a Test Button </Button>

What I obtain is that the padding for the right/left side is correctly set to 0, while the one for top/bottom is not updated, see the attached image.

Is this a bug? Or what's the correct way to achieve this?

EDIT: Material-UI version: v1.0.0-beta.20

enter image description here

Автор: r4id4 Источник Размещён: 08.11.2017 10:32

Ответы (1)


2 плюса

507 Репутация автора

Решение

This behavior is caused by the min-height and min-width properties of the root key of the Button element. Setting minHeight: 0 and/or minHeight:0 should fix it:

button: {
    display: 'inline-block',
    padding:0,
    minHeight: 0,
    minWidth: 0,
  }
Автор: Brunno Vodola Martins Размещён: 08.11.2017 10:53
Вопросы из категории :
32x32