简体   繁体   English

如何在React JS中增加td标签中输入字段的宽度

[英]how to increase the width of the input field in td tag in react JS

I have below FormControl in react bootstrap table我在反应引导表中有以下 FormControl

<Table responsive striped bordered hover>
            <thead>
                <tr>
                    <th>#</th>
                    {Object.keys(tableData[0]).map((header, index) => (
                        <th key={index}>{header} </th>
                    ))}
                </tr>
            </thead>
            <tbody>
                {tableData.map((data, index) => (
                    <tr key={index}>
                        <td>{index + 1}</td>
                        <td>
                            {<FormControl
                                placeholder="Username"
                                aria-label="Username"
                                aria-describedby="basic-addon1"
                                value={data.Date}
                            />}
                        </td>
                        <td>{data['Long/Short']}</td>
                   
                    </tr>
                ))}

            </tbody>
        </Table>
    </Container>

And it renders as below它呈现如下

在此处输入图片说明

I have tried setting the width using style={{width: "200px"}} to td tag, th tag and FormControl tag but nothing worked, please let me know what am I missing here我尝试使用style={{width: "200px"}}style={{width: "200px"}}设置为 td 标签、th 标签和 FormControl 标签,但没有任何效果,请让我知道我在这里遗漏了什么

You could try and add a CSS rule:您可以尝试添加 CSS 规则:

td input[type='text'] {
min-width: 150px
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM