jsp里用CSS巧妙实现隔行效果

   JSP里,可以充分利用CSS来实现隔行效果,比如如下代码

<style>
  /* Even row */
  .row1 {background-color:orange;}

  /* Odd row */
  .row0 {background-color:yellow;}
  
  /* Title row */
  .title {background-color:blue;color:white;text-align:center;}
 </style>
</head>
<body>
<div align="center">
 <h3>Dynamic Style</h3>
 <table width="300">
  <tr class="title">
   <th width="100">Day</th>
   <th>Rain Percent</th>
  </tr>
  <c:forEach var="day" items="${weekWeather}" varStatus="loop">
  <tr class="row${loop.count%2}">
   <td align="left">${day.item}</td>
   <td align="right">${day.percent}%</td>
  </tr>
  </c:forEach>

你可能感兴趣的:(css)