optimization - How to optimize CSS background-image and background-position properties -


i'm following tutorial on front-end development, , wrote ruleset header image:

header {     background-image: linear-gradient(#00000070, #00000070), url("../img/hero.jpg");     background-position: center;     background-size: cover;     height: 100vh; } 

pycharm tells me background-image , background-position properties can optimized transforming them shorthand form, doesn't provide specific advice on how. i'm beginner css, can't infer problem, , w3schools.com didn't offer shorthand. how else can write block shorten it?

as defined w3c there should slash separating backgound-size background-position , comma separate image gradient:

background:     url("../img/hero.jpg")              /* image */     center / cover,                     /* position / size */     linear-gradient(red, green)         /* gradient */ ; 

in 1 line without comments:

background: url("../img/hero.jpg") center / cover, linear-gradient(red, green); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -