tra*_*les 5 reactjs material-ui
如何使材料UI按钮左对齐标签?没有任何道具可以直接更改button元素上的内联样式,而我能想到的唯一方法是添加一个类并编写一些总的CSS选择器,例如thisClass> div> button。
小智 9
我对带有图标的按钮有类似的问题。我通过证明内容来修复它:
<Button
startIcon={<AccountCircleIcon/>}
fullWidth={true}
style={{justifyContent: "flex-start"}}>
button text
</Button>
Run Code Online (Sandbox Code Playgroud)
absolute您可以使用labelStyle元素上的属性来指定标签定位。这有效:
<RaisedButton
label="Primary"
primary={true}
lableStyle={{position: 'absolute',top: 0,left: -10}} />
Run Code Online (Sandbox Code Playgroud)
编辑:用更好的方法更新我的答案
在按钮上使用文本对齐:
<RaisedButton
style={{textAlign: 'left'}}
label="Primary"
primary={true}/>
Run Code Online (Sandbox Code Playgroud)
在标签上使用浮动:
<RaisedButton
lableStyle={{float: 'left'}}
label="Primary"
primary={true}/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3652 次 |
| 最近记录: |