How do I make the table not leave the tab

Asked

Viewed 131 times

0

I’m having a hard time putting a table inside a tab because it’s always outside.

I have the following code:

  echo'<div id="tabs-1">


  <p><b>Alvará: </b></p>';
    echo '<table width=500>
    <tr>
    <td><b>Número</b></td>
    <td><b>Validade</b></td>
    <td><b>Anexo</b></td>
    </tr>';
    echo "<td>".$exibe['AlvaraNumero']."</td>";
    if ($exibe['AlvaraValidade']) { 
    if (strtotime($exibe['AlvaraValidade']) < time())  {
    echo "<tr>";
    echo " <td>'<span style='color:red'>".$exibe['AlvaraValidade']."</span>'</td>";
    }else{
    echo " <td>".$exibe['AlvaraValidade']."</td>";
    }
    echo "<td><a href='MostrarAlvara.php?id=".$exibe['id']."'>Ver PDF </a></td>";
    echo "</tr>";
    }
    echo '</table>';
  '</p>
  </div>';
  • Post also the CSS code, so it gets complicated to say, because if you have a fixed size of tabs-1 and the size of the table is larger than this, this may be the reason. see http://jsfiddle.net/abfurlan/4YmKG/

  • i didn’t use css. But out of the tab the size is good

  • Ask your question about the output that breaks from this php generated in the browser in your question or in a Jsfiddle. This makes it easier to see the problem.

1 answer

1

This table doesn’t look very well built. That could be the problem. I don’t know how you want the table, but it’s something like... ?

echo'
<div id="tabs-1" style="overflow:auto;">
    <p><b>Alvará: </b></p>';
echo '
<table width=500>
    <tr>
        <td><b>Número</b></td>
        <td><b>Validade</b></td>
        <td><b>Anexo</b></td>
    </tr>
    <tr>
        <td>' . $exibe['AlvaraNumero'] . '</td>';

if ($exibe['AlvaraValidade']) {
    if (strtotime($exibe['AlvaraValidade']) < time()) {
        echo " <td>'<span style='color:red'>" . $exibe['AlvaraValidade'] . " </span>'</td>";
    } else {
        echo " <td>" . $exibe['AlvaraValidade'] . "</td>";
    }
    echo "<td><a href='MostrarAlvara.php?id=" . $exibe['id'] . "'>Ver PDF </a></td>";
}
echo '
        </tr>
    </table>
</div>
';
  • The table is as I want. But Even with the table so is the "Alvara" inside the Tab and the table itself is outside the Tab.

  • I’m not sure if this is what you want but adding the style to the div works? If the table doesn’t fit in the div and goes out it’s because it’s bigger. With the style it fits inside the div and uses a scrollbar if it is larger.

  • but from what I see the size is great and that is not the reason why the table leaves the div. I even put a very small table and is left out

Browser other questions tagged

You are not signed in. Login or sign up in order to post.