当我的行具有左右单元格时,如何使文章以html动态呈现时出现了问题。下面是我的代码。当我这样做时,第一篇文章(索引中的第0条)在第1行中同时放在左和右位置。如果我有8条文章,我希望有4行,每行有两篇不同的文章,但我却得到了8条同一篇文章的左右行。
<!--=================-Rows with 2 items in each section=================-->
<table width="640" align="center" class="em_main_table em_fixed" border="0" cellspacing="0" cellpadding="0">
{{#each sections}}
{{#ifEqual this.sectionId "section2-articles"}}
{{#if this.items.[0]}}
{{#each items}}
{{#ifEqual this.contentType "article"}}
<tr>
<td valign="top" align="center" class="em_pad">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top">
<table width="276" class="em_wrapper" border="0" cellspacing="0" cellpadding="0" align="left" >
<tr>
<td align="center" valign="top" class="em_top_5" >
<a href="{{url}}" target="_blank" class="em_text_none" >
<img src="{{imageUrl}}?W=276" width="276" height="175" class="em_img3" border="0" alt=""/>
</a>
</td>
</tr>
<tr>
<td height="5" class="em_height em_f_h_zero"> </td>
</tr>
<tr>
<td align="left" class="em_black1 em_heada" >
<a href="{{url}}" target="_blank">{{title}}</a>
</td>
</tr>
</table>
<table width="276" class="em_wrapper" border="0" cellspacing="0" cellpadding="0" align="right" >
<tr>
<td align="center" valign="top" class="em_top em_top_5" >
<a href="{{url}}" target="_blank" class="em_text_none" >
<img src="{{imageUrl}}?W=276" width="276" height="175" class="em_img3" border="0" alt=""/>
</a>
</td>
</tr>
<tr>
<td height="5" class="em_height em_f_h_zero"> </td>
</tr>
<tr>
<td align="left" class="em_black1 em_heada" ><a href="{{url}}" target="_blank">{{title}}</a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30" class="em_height em_f_h_zero"> </td>
</tr>
{{/ifEqual}}
{{/each}}
{{/if}}
{{/ifEqual}}
{{/each}}
</table>
<!--=================-Rows with 2 items in each section=================-->
答案 0 :(得分:0)
缩进代码是正确读取代码的唯一方法。
使用div
和CSS句柄而不是表来完成这项工作。