我可以更改单击时生成的蓝线的颜色吗?
class Hello extends React.Component {
render() {
return <div>Hello {this.props.name}</div>;
}
}
ReactDOM.render(
<div>
<p tabIndex={-1}
style={{}}
onKeyDown={event => alert(event.keyCode)}>
Click to focus, then hit a key.
</p>
</div>,
document.getElementById('container')
);
https://jsfiddle.net/s7bjk42m/
最佳答案
您需要更改CSS的:focus
选择器。您可以使用以下内容删除轮廓,然后在:focus
状态为活动状态时通过添加边框来替换轮廓。
#container p:focus{
outline:none;
border:1px solid #000;
}
关于javascript - 将蓝线更新为白色,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58185223/