如何在Semantic React UI中扩展Input的宽度大小?

问题描述 投票:1回答:1

我正在使用Reactjs项目,我使用Semantic UI React来美化Input。但是,似乎Input始终以默认大小显示。如何调整其水平宽度?

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.12/semantic.min.css"></link>

  • 在js文件中我导入:

import { Input } from 'semantic-ui-react';

  • 并呈现输入:

<Input value={this.state.firstName} onChange={this.handleInputFirstName}/>

reactjs semantic-ui semantic-ui-react
1个回答
0
投票

添加style={{ width:"300px" }}对我来说非常好。我正在使用与你相同的样式表。您可以查看以下代码:

const App = () => (
  <div style={styles}>
    <h2>Start editing width and see magic happen {'\u2728'}</h2>
    <Input placeholder="Hello there" style={{width: "370px"}}/>
  </div>
);

这里可以看到工作示例: Edit StackOverflow 2

© www.soinside.com 2019 - 2024. All rights reserved.