I want to implement margin-right inline CSS to the below react span element:
import React, { Component } from "react";
class NavBar extends Component {
state = {
totalCounters: 0,
};
render() {
let styles = {
margin-right: '20px',
width: '250px',
height: '250px',
backgroundColor: 'yellow',
};
return (
<nav className="navbar navbar-light bg-light">
<a className="navbar-brand" href="#">
Navbar
</a>
<span style={styles} className="badge badge-pill badge-secondary">
{this.props.totalCounters}
</span>
</nav>
);
}
}
export default NavBar;
Run Code Online (Sandbox Code Playgroud)
But it shows syntax error, while no error if replacing margin-right with margin. So how to do it?
| 归档时间: |
|
| 查看次数: |
1402 次 |
| 最近记录: |