Remove type when value is 0

1

I have Web Essentials installed in my Visual Studio, and it made me the following recommendation:

Soon,Iremovedthedrivetype.ThestyleworkedperfectlyinChrome,butwhentestinginFirefoxandIE,itwasconsideredinvalid.

Samplecode:

.mydiv {
  width: 100%;
  height: 100px;
  background: linear-gradient(0, red, yellow);
  border: solid black 1px;
}
<div class="mydiv"></div>

Would it really be good practice to remove the CSS unit type when the value is 0?

Is there any other alternative than to enter the unit type?

    
asked by anonymous 22.03.2017 / 18:00

1 answer

0

Hello, so to work in other browsers follow an example below:

background: -webkit-linear-gradient(left, #77e859 , #8ec982); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(right, #77e859, #8ec982); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(right, #77e859, #8ec982); /* For Firefox 3.6 to 15 */

And the drive, I think it's okay to put 0 .

This will help you to work in other browsers ...

.mydiv {
  width: 100%;
  height: 100px;
  background: linear-gradient(0, red, yellow);
  background: -webkit-linear-gradient(0, red, yellow); /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient(0, red, yellow); /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient(0, red, yellow); /* For Firefox 3.6 to 15 */
  border: solid black 1px;
}
<div class="mydiv"></div>

References

22.03.2017 / 18:13