【发布时间】:2022-02-06 07:12:15
【问题描述】:
我的问题是我的 antd 按钮中的文本和图标在我的 react 应用程序中没有垂直对齐。
代码如下:
<Button type="primary" size="large" block icon={<PlusCircleOutlined />} onClick={()=>this.showModalSharePicture()}>
Text
</Button>
与文本相比,图标有点低,女巫在按钮中居中。 如何解决我所有按钮中的这个问题?
这里是渲染的 html:
<button type="button" class="ant-btn ant-btn-primary ant-btn-lg ant-btn-block"><span role="img" aria-label="plus-circle" class="anticon anticon-plus-circle"><svg viewBox="64 64 896 896" focusable="false" data-icon="plus-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"></path><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"></path></svg></span><span>Text</span></button>
【问题讨论】:
-
它可能有助于提供呈现的 HTML 和相关的 CSS 来演示问题的working example。
-
您好,我刚刚添加了渲染的 html。但是您可以在这里看到一个工作示例:app.tipmymeme.com
标签: javascript css reactjs antd