Css 覆盖按钮的文本颜色
这是密码Css 覆盖按钮的文本颜色,css,reactjs,material-design,Css,Reactjs,Material Design,这是密码 export function ViewCurrentPitch(props){ const actions = [ <FlatButton label="Cancel" primary={true} onClick={props.closeEditPitch} />, <FlatButton className= 'flat-button'
export function ViewCurrentPitch(props){
const actions = [
<FlatButton
label="Cancel"
primary={true}
onClick={props.closeEditPitch}
/>,
<FlatButton
className= 'flat-button'
label="Save"
primary={true}
keyboardFocused={true}
onClick={props.savePitchBeingEdited}
/>,
];
console.log(props)
return (
<Card key={props.pitch.id} className = 'form-margin card-width' zDepth={3}>
<CardText>{props.pitch.subject} </CardText>
<CardText className='card'>{props.pitch.pitch}</CardText>
<CardActions className= 'this-is-a-test'>
<FlatButton className= 'flat-button' label="Edit" onClick={(e) => {props.toggleEdit(e, props.pitch); console.log(props.state)}}/>
<Dialog
className="dialogBox"
title="Test"
actions={actions}
open={props.editPitch}
contentStyle={customContentStyle}
autoScrollBodyContent={true}
>
<TextFieldExampleCustomize currentValue = {props.pitchBeingEdited} updateNewPitch = {props.updatePitchBeingEdited} />
</Dialog>
<FlatButton className= 'flat-button' label="Delete" onClick={(e) => {props.deletePitch(e, props.pitch)}} />
</CardActions>
</Card>
)
}
我尝试了父组件和特定组件。两者似乎都不起作用。我需要将其作为内联样式传递吗
我做错了什么>在设置样式时,应该使用组件上的“样式”属性。有关此类样式和其他技术的更多信息,请参见此处:相对于: 可以使用属性
style
替代样式,如:
// Note: style is an object, not css
<FlatButton className='flat-button' style={color: 'pink'} />
FlatButton似乎带有一个限定范围的css,不应该被经典css修改,更多:Color只应该更改按钮文本的颜色,但是,如果您试图更改整个按钮的颜色,背景色或背景色应该可以解决您的问题。FlatButton应该是范围样式HI@pirs,我不知道这意味着什么:-(嗨@MarshallMunoz,我只想更改文本颜色。有没有办法在CSS文件中设置它,这样我就不必对每个按钮进行设置?或者对每个按钮进行多次样式更改?嗯。我在内联
{props.deletePitch(e,props.pitch)}中添加了style='{color:pink}'
}/>
但它没有做任何事情啊,我得到了const buttonStyle={color:'pink'}
然后添加了style={buttonStyle}
在几个小时内你肯定会把它搞定:-),仔细阅读文档
// Note: style is an object, not css
<FlatButton className='flat-button' style={color: 'pink'} />
<FlatButton className='flat-button' primary=true />