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
Post a Comment