简体   繁体   English

href没有在表td上工作,但它适用于ul li

[英]href not working on table td's but it works on ul li's

I am in bit of a situation here. 我在这里有点情况。 When I change the tr to ul and td to li then the links work but in the table it links does not work. 当我将tr更改为ul并将td更改为li时,链接可以正常工作,但在表中链接不起作用。 The links are fetched by permalink and the code after that 链接由永久链接和之后的代码提取

if (sizeof($allMessages)>0)
    {
      foreach($allMessages as $message){?>
            <tr>
                <a href="<?php echo get_the_permalink(); ?>?candidate-page=mailbox-readmail&messageId=<?php echo esc_html__($message['id'],'nokri') ?>" class="list-inline"><?php if(in_array("UNREAD", $message['labelIds'])){ ?><b class="list-inline">
                <td class="posted-job-title"><?php echo esc_html__($message['email'] , 'nokri' ); ?></td>
                <td class="posted-job-status"><?php echo esc_html__( $message['subject'], 'nokri' ); ?></td>
                <td style="margin-right: 148px;" class="posted-job-status"><?php echo esc_html__( $message['from'], 'nokri' ); ?></td>

                </b>
                <?php } else { ?>
                <td class="posted-job-title"><?php echo esc_html__($message['email'] , 'nokri' );?></td>
                <td class="posted-job-status"><?php echo esc_html__( $message['subject'], 'nokri' ); ?></td>
                <td style="margin-right: 147px;" class="posted-job-status"><?php echo esc_html__( $message['from'], 'nokri' ); ?></td>
                <?php } ?>
                </a>
                <td>
                <a href="<?php echo get_the_permalink(); ?>?candidate-page=mailbox-inbox&messageId=<?php echo esc_html__($message['id'],'nokri') ?>&delete=true" class="list-inline"><li class="posted-job-action"><i class="fa fa-trash" aria-hidden="true"></i></li></a>
                </td>
            </tr>
      <?php

I don't think that's how a table structure should flow. 我不认为表结构应该如何流动。 Right now, a simplified version of your table structure looks like this: 现在,表结构的简化版本如下所示:

<tr>
 <a href="/content">
  <td>Content here</td>
 </a>
</tr>

The <a> tag is inside of the TR element. <a>标记位于TR元素的内部。

Have you tried putting the <a> tag in the TD element? 您是否尝试将<a>标记放在TD元素中?

<tr>
 <td>
  <a href="/content">Content here</a>
 </td>
</tr>

The <a> tag is now inside of the table cell its self, and content should flow nicely. <a>标签现在位于表格单元格内部,内容应该很好地流动。

Also look for any syntax errors. 还要查找任何语法错误。 Best of luck! 祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM