Reputation: 55
<div className="card border-0 shadow " style={{margin: '0 500px' }}>
The above code describes how to add margins to a component ,but why can't it be written like this:
<div className="card border-0 shadow " style={{top-margin: '500px';left-margin : '200px' }}>
Upvotes: 0
Views: 323
Reputation: 9
you have to write it like this
<div className="card border-0 shadow " style={{marginTo: '500px';left-margin : '200px' }}>
Upvotes: 0
Reputation: 625
Because you're writing in JSX syntax which means you need to pass an object to the style attribute/prop. These object keys need to be in camelCase notation. You can use CSS classes and add them in the className
name attribute as well or just use styled-components
.
Upvotes: 0
Reputation: 48
Your style syntax is wrong, replace ;
with ,
to make it a valid object. Also object keys should be in camelCase.
Example:
style={{ marginTop: '500px', marginLeft: '200px' }}
Upvotes: 1