【发布时间】:2021-01-13 18:49:03
【问题描述】:
我有以下卡,代码如下。我想把所有东西排成一排,因为现在它是一个在另一个之下。是否有任何选项可以将所有内容对齐单行而不是三行,
<div class="container">
<form onSubmit={submitHandler}>
<div class="row" style={{ width: "300px", marginTop: "40px", marginLeft: "70px", height: "450px" }}>
<FormControl variant="outlined">
<InputLabel id="demo-simple-select-outlined-label" >Choose Module Type</InputLabel>
<Select style={{ marginBottom:"20px"}}
name="name"
labelId="demo-simple-select-outlined-label"
id="demo-simple-select-outlined"
onChange={handleDropdownChange}
label="TypeList"
>
{
dropdown.map(options =>
<MenuItem value={options["moduleType"]} >{options["moduleType"]}</MenuItem>
)}
</Select>
<TextField
style={{ marginTop: "10px", marginBottom:"20px" }}
id="outlined-helperText"
label="Module Name"
onChange={handleChangeModuleName}
variant="outlined"
/>
<TextField
style={{ marginTop: "20px" }}
id="outlined-helperText"
label="Course Duration"
onChange={handleChangeDuration}
variant="outlined"
/>
<div style={{ margin: "auto", marginTop: "20px" }}>
<Button type="submit" variant="contained" color="primary">ADD</Button>
</div>
</FormControl>
</div>
</form>
</div>
请帮忙:) 谢谢
【问题讨论】:
-
CSS flexbox 应该可以在这里工作,因为它们可以使它们垂直和水平居中,在此处阅读更多关于 flexbox css-tricks.com/snippets/css/a-guide-to-flexbox
标签: css reactjs material-ui