简体   繁体   中英

How can I change the background color of the body in index.html?

I'm new to Reactjs. I did some researches in google on how to change the background color of the body in index.html but nothing work. I have tried to use <style> tag in the <head> tag and I have also tried to create new style.css file in public folder and linked it to index.html but it changed nothing!

here is how I linked style.css to index.html <link href="%PUBLIC_URL%/style.css" rel="stylesheet"/>

Please help! Thank before hand

Update. When I refreshed the page the background color did change but only in around 0.001s then It went back to white.

For inline CSS you can try:

<body style="background-color:yellow;">
      <h1>Products</h1>
      <p>We have developed more than 10 products till now.</p>
 </body>

In your index.css , add:

body {
  background-color: 'blue';
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM