我想用flex display
分隔兩個按鈕。我正在使用react
。如何使用`flex display`來分隔兩個按鈕。
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佈局的所有信息:https://facebook.github.io/react-native/docs/flexbox.html,您也可以使用'保證金'適當性(例如:marginLeft:20,marginRight:20)它也可以工作 –
'justifyContent:'space-between''或'space-around',或者是OK。 – jiexishede