Estilo em linha JSX
//Multiple inline styles
<div style={{padding:'0px 10px', position: 'fixed'}}>Content</div>
Puzzled Puffin
//Multiple inline styles
<div style={{padding:'0px 10px', position: 'fixed'}}>Content</div>
// You are actuallty better off using style props
// But you can do it, you have to double brace
// and camel-case the css properties
render() {
return (
<div style={{paddingTop: '2em'}}>
<p>Eh up, me duck!</p>
</div>
)
}
// use inline style in react
const myFunction = () => {
return (
<p style={{ fontSize: 24, margin: '0 auto', textAlign: 'center'}}>
Hello world
</p>
);
}
function MyComponent(){
2
3return <div style={{ color: 'blue', lineHeight : 10, padding: 20 }}> Inline Styled Component</div>
4
5}
// Change the background color to red
document.body.style.backgroundColor = "red";
const MyStyledComponent = props =>
<div className="styled">
Hover for red
<style dangerouslySetInnerHTML={{__html: `
.styled { color: blue }
`}} />
</div>