html中和之间的字体居中问题:

html中和之间的字体居中问题:

代码如下

<div class="girdbox">
  <table class="maintable">
    <thead>
    <tr>
      <th width="55%" style="text-align:center;">活动名称</th>
      <th width="25%" style="text-align:center;">活动时间</th>
      <th width="20%" style="text-align:center;">社区</th>
    </tr>
    </thead>
    <tbody>
    <#list result as res>
    <tr>
      <td align="center">
        <#if (res.fydjcaActname?length>50) >
        &nbsp;${"${res.fydjcaActname!''}"?substring(0,50)}...
        <#else>
        &nbsp;${res.fydjcaActname!''}
      </#if>
      </td>

    <td align="center"><#if (res.fydjcaActstime??)>${(res.fydjcaActstime)?date}</#if> - <#if (res.fydjcaActetime??)>${(res.fydjcaActetime)?date}</#if></td>
  <td align="center"> ${res.fydjcaEcname!''}</td>
</tr>
</#list>
</tbody>
</table>
</div>
  1. 对于th标签我们想要字体居中,我们可以这样编写。
<th width="55%" style="text-align:center;">活动名称</th>
  1. 对于td标签我们想要字体居中,我们可以这样编写。
<td align="center"> ${res.fydjcaEcname!''}</td>
  1. 效果如下,完美解决字体内容的居中问题。
    在这里插入图片描述

你可能感兴趣的:(学习)