【发布时间】:2017-01-26 12:42:16
【问题描述】:
我试图让一个复选框出现在输入字段“answer input one”的右侧
这是呈现答案输入的代码:
<div>
<TextField
hintText="An informative question title..."
fullWidth
floatingLabelText="Question Title"
value={questionTitle}
onChange={(e) => this.props.questionTitleChanged(e.target.value)}
/>
<TextField
floatingLabelText="Answer Input 1"
onChange={(e) => this.props.questionInputChanged({
inputIndex: 0,
value: e.target.value,
correct: false
})}
value={questionInputs[0].value}
style={styles.answerField}
/>
<Checkbox
onCheck={() => {
let correctOrIncorrect = null;
if (questionInputs[0].correct) {
correctOrIncorrect = false;
} else { correctOrIncorrect = true; }
this.props.questionInputChanged({
inputIndex: 0,
value: null,
correct: correctOrIncorrect });
}}
style={styles.checkbox}
/>
</div>
内联样式在这里:
const styles = {
createQuizContainer: {
width: '70%',
margin: 'auto',
paddingTop: 30,
paddingBottom: 40
},
answerField: {
width: '70%',
},
checkBox: {
display: 'inline',
}
};
我们将不胜感激!以及关于一般 css 布局的任何建议!
谢谢。
【问题讨论】:
标签: css material-ui