简体   繁体   中英

Linear gradient for background image in JavaScript

I am getting an error with this code:

var sectionStyle = {
  paddingTop:"2%",
  width: "100%",
  height: "100%",
  backgroundImage: "url(" + Background + ") , linearGradient(#eb01a5, #d13531)"
}

The error is:

parsing error Failed to compile. ./src/App.js Line 203: Parsing error: Unexpected token 201 | width: "100%", 202 | height: "100%", > 203 | backgroundImage: "url(" + Background + ")" , linearGradient(#eb01a5, #d13531'); | ^ 204 | } 205 | 206 |

Instead of : type =

try this

var sectionStyle = {
  paddingTop = "2%",
  width = "100%",
  height = "100%",
  backgroundImage = "url(" + Background + ") , linearGradient(#eb01a5, #d13531)"
}

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