【发布时间】:2021-01-15 01:26:25
【问题描述】:
在编码方面有点菜鸟,但我试图在我的页面上从上到下而不是从左到右列出选项。
return (
<div className="quizChallenge">
<WebHeader/>
<h2 id = "description"> {this.state.quizzes.description}</h2>
<ol>
<table id="t01">
<tbody>
<tr>
{this.state.options.map((option) => {
return (
<td key={option}>
<button disabled={!this.state.optionEnabled} onClick={() => this.checkAnswer(this.state.options.indexOf(option))}>
{option}
</button></td>
);
})}
</tr>
</tbody>
</table>
</ol>
{currentQuestion < 8 &&
<button className="ui inverted button" disabled={this.state.disabled} onClick={this.nextQuestion}>Next</button>
}
{currentQuestion === 7 &&
<button className="ui inverted button" disabled={this.state.disabled} onClick={this.lastQuestion}>Finish Quiz!</button>
}
</div>
);
有人可以帮助我以最好的方式做到这一点吗?
【问题讨论】:
-
检查 flexbox,这应该为你做的事情w3schools.com/css/css3_flexbox_container.asp
-
用
tr将td包裹在return中,并删除地图函数之外的tr