If you want to update modal backdrop you could use CSS like:
.modal-backdrop {
background-color: green;
}
If you want to change modal background then use:
<Modal className="my-modal" show={show}>
and define in CSS:
.my-modal .modal-content {
background-color: red;
}
Answer from tarzen chugh on Stack OverflowIf you want to update modal backdrop you could use CSS like:
.modal-backdrop {
background-color: green;
}
If you want to change modal background then use:
<Modal className="my-modal" show={show}>
and define in CSS:
.my-modal .modal-content {
background-color: red;
}
You need to appy CSS to modal-content class to change background-color.
Add a class name to your modal where you want to apply background color,
<Modal
show={this.state.show}
onHide={this.handleClose}
dialogClassName="modal-90w public-profile-modal-class"
size='lg'
aria-labelledby="example-custom-modal-styling-title"
className="special_modal" //Add class name here
>
Use that class name to apply CSS
.special_modal .modal-content{
background-color: #000;
color: #fff;
}
Demo
Just assign an object with your styles for the overlay to a variable say, bg inside your render and then just use the styles prop to reference that object in your Modal like this:
render() {
const bg = {
overlay: {
background: "#FFFF00"
}
};
return (
<div className="childDiv">
<Modal open={open} onClose={this.onCloseModal} center styles={bg} }}>
<p>Your Modal Content</p>
</Modal>
</div>
)
}
But wait. Why create an extra object when we can just write the styles directly instead like this:
<Modal open={open} onClose={this.onCloseModal} center styles={background: "#FFFF00"}>
<p>Your Modal Content</p>
</Modal>
The above approach won't work even though it looks like it's doing the same thing as my code and that is because you can't directly specify styles inline on react-responsive-modal. You need to place the styles in an object first and then reference the styles prop to that object.
You can however create the object within the styles prop itself by doing this:
<Modal open={open} onClose={this.onCloseModal} center styles={{ overlay: { background: "#FFFF00" } }}>
<p>Your Modal Content</p>
</Modal>
But it is recommended that you define objects outside and then reference it inside the styles prop as shown above.
You can change the CSS of overlay by styles props of Modal
<Modal animationDuration={1000} styles={{ modal: {}, overlay: { background: "#ccc" } }} closeIconSize={16} open={modalOpen} onClose={this.onCloseModal} center >
Your Code Here...
</Modal>

Please see the full documentation of react-responsive-modal here
I am assuming you want to set the opacity of the modal background...
Set the opacity via CSS
.modal-backdrop
{
opacity:0.5 !important;
}
!important prevents the opacity from being overwritten - particularly from Bootstrap in this context.
You can override the modal-backdrop opacity in your stylesheet [take note of the .in class]
.modal-backdrop.in {
opacity: 0.9;
}
http://jsfiddle.net/ThisIsMarkSantiago/r0gwn005/1/