Code pour pouvoir gérer un dégradé linéaire.

CSS à utiliser

  1. .test {
  2. height:300px;
  3. background: #FFF url(../img/test.svg);
  4. filter:progid:DXImageTransform.Microsoft.Gradient(GradientType='0', StartColorStr='#f36421', EndColorStr='#f28829'); //IE
  5. background: -moz-linear-gradient(top, #f36421, #f28829); // navigateur utilisant Gecko
  6. background: -webkit-gradient(linear, left top, left bottom, from(#f36421), to(#f28829)); // navigateur utilisant Webkit
  7. }

Pour Opera, il faut utiliser une image SVG

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <svg xmlns="http://www.w3.org/2000/svg">
  3. <defs>
  4. <linearGradient id="gray" x1="0%" y1="0%" x2="0%" y2="100%">
  5. <stop offset="0%" style="stop-color:rgb(243,100,33); stop-opacity:1"/>
  6. <stop offset="100%" style="stop-color:rgb(242,136,41); stop-opacity:1"/>
  7. </linearGradient>
  8. </defs>
  9.  
  10. <rect style="fill:url(#gray)" x="0" y="0" width="100%" height="100%" rx="0"/>
  11. </svg>

Source d’inspiration : Blog de Pascal Chevrel ainsi que le labs de Thomas Basseto. Merci à eux pour les informations récupérées