简体   繁体   中英

How to apply a linear-gradient background to a table row in IE9?

I want to apply a linear-gradient background to a table row.

Here's the .css:

<style type="text/css">
 .contentBody{
   background-image: -webkit-linear-gradient(left, #95b83d 0%, #abca5e 100%);
   background-image: -o-linear-gradient(left, #95b83d 0%, #abca5e 100%);
   background-image: linear-gradient(to right, #95b83d 0%, #abca5e 100%);
   background-repeat: repeat-x;
   filter: progid:DXImageTransform.Microsoft.gradient (startColorstr='#ff95b83d', endColorstr='#ffabca5e', GradientType=1);
  }
...
</style>

And here's the .html:

<table>
  <tr class="contentBody"> Heading</tr>
    <td></td>
  </tr>
</table>

What I am doing wrong here? Why the gradient isn't shown?

well, "Heading" text has to be wrapped with a td like so:

<table>
  <tr class="contentBody"><td>Heading</td></tr>
    <td></td>
  </tr>
</table>

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