【发布时间】:2018-09-25 04:20:09
【问题描述】:
我正在尝试更改标记链接的文本颜色。但它不起作用。我不明白“a:link”和“a:visited”语法在“testBoXStyle”变量中的组件类中的外观。
组件代码:
class TestBox extends React.Component {
constructor(props){
super(props);
this.state = {
opac: 0.0,
wid: 5,
hei: 5,
topp: 200,
leftt: 200
};
updateTestBoxState = updateTestBoxState.bind(this);
}
render(){
var testBoXStyle = {
transition: 'width 0.2s ease-out, height 0.2s ease-out, opacity 0.2s ease-out, transform 0.5s ease-out, left 0.5s ease-out, top 0.5s ease-out',
width: this.state.wid,
height: this.state.hei,
backgroundColor: '#2222FF',
opacity: this.state.opac,
boxShadow: "3px 3px 20px #333333",
borderRadius: 5,
padding: 10,
position: 'absolute',
top: this.state.topp,
left: this.state.leftt,
a:'link {color: white)}',
a:'visited {color: white)}'
}
return (
<div style={testBoXStyle}>
<h1>Contacts:</h1>
Some info...
<br/>Some info...
<br/>Some info...
<br/>Some info...
<br/>Some info...
<br/><a target="_blank" href="https://www.youtube.com/">Youtube</a>
</div>
);
}
}
【问题讨论】:
标签: reactjs colors hyperlink components