【发布时间】:2017-08-12 23:31:19
【问题描述】:
我想使用flex display 来分隔两个按钮。
现在,我正在使用react。
const style = {
textAreaStyle: {
width:'700'
},
buttonFatherStyle:{
display:'flex',
display:"-webkit-flex",
flexWrap: 'wrap',
justifyContent:'around',
backgroundColor:'red',
}
}
我的jsx:
<div style={style.buttonFatherStyle}>
<FlatButton style={{backgroundColor:'blue'}} type="submit" disabled={pristine || submitting}> submit </FlatButton>
<FlatButton style={{backgroundColor:'green'}} type="button" disabled={pristine || submitting} onClick={reset}> Clear
</FlatButton>
</div>
我的代码不起作用。
【问题讨论】:
-
你试试
justifyContent: 'space-between'吗? -
你可以在这里阅读所有关于 flex Layout 的信息:facebook.github.io/react-native/docs/flexbox.html 并且你也可以使用“margin”的适当性(例如:marginLeft:20,marginRight:20)它也可以工作
-
justifyContent: 'space-between'或space-around都可以。 -
好吧,你能把我的答案标记为验证吗? :)