Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to display icon in center in ant design Button

I am using ant design Button and setting the icon but the icon is not displayed in center inside button.

enter image description here

import "antd/dist/antd.css";
import { DeleteOutlined } from "@ant-design/icons";

<Row>
  <Col span={2} style={{ padding: "5px" }} >
                                <Button
                                    type="primary"
                                    size="middle"
                                    shape="circle"
                                    danger
                                    icon={<DeleteOutlined />}

                                    onClick={() => deleteSkid(index)}
                                />
                            </Col>
</Row>

I also tried like this but there's no change.

<Row>
  <Col span={2} style={{ padding: "5px" }} >
            <Button
               type="primary"
               size="middle"
               shape="circle"
               danger
               onClick={() => deleteSkid(index)}
             >
                   <DeleteOutlined />
              </Button>
    </Col>
</Row>
like image 426
Archit Sandesara Avatar asked Sep 13 '25 10:09

Archit Sandesara


1 Answers

Are you using bootstrap or tailwind CSS? Try adding this:

svg { vertical-align: baseline; }
like image 157
blainedeyoung Avatar answered Sep 16 '25 01:09

blainedeyoung