0
<Button type="submit" className="Form__Button mr-20">Sign In</Button>

I'm working on jsx file, I want to add custom style for above Button if I try this

{<style type="text/css">
  {`
   .Form__Button {
      background-color: #52C4B9;
      color: white;
      border: none;
      outline: none;
      border-radius: 25px;
    }
  `}
</style>

But if I use style in a different css file it not work

2
  • You can put this style in another css file and import it or you can use inline style Commented Mar 16, 2020 at 6:55
  • That what I have done Commented Mar 16, 2020 at 7:43

1 Answer 1

1

Option 1:

Create a new file called "App.css" and insert some CSS code in it:

.Form__Button {
   background-color: #52C4B9;
   color: white;
   border: none;
   outline: none;
   border-radius: 25px;
}

In your JSX file:

import './App.css';

Option 2:

class MyHeader extends React.Component {
  render() {
    const myButton = {
      background-color: #52C4B9;
      color: white;
      border: none;
      outline: none;
      border-radius: 25px;
    };
    return (
      <div>
      <Button type="submit" style={myButton}>Sign In</Button>
      </div>
    );
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.