关于这个css打印问题的任何建议

时间:2010-05-01 04:52:36

标签: css html printing

我在print.css上有这段代码:

#header, #tae, #nav, .noprint {display: none;}                          
width: 100%; margin: 0; float: none;

为了不显示这些div标签中的元素。但我不知道下面的代码为什么它不合作。如果我将div标签放在上面。然后我点击了打印按钮。我看不到输出。 这是:

<div id="tae">

<table border="0" align="center" cellpadding="0" cellspacing="0" class="bg1">
    <tr>
        <td class="text1" style="height: 50px;">xd627 information management system</td>
    </tr>

    <tr>
        <td class="bg5"><table border="0" cellspacing="0" cellpadding="0" style="height: 62px; padding-top: 15px;">
            <tr align="center">
                <td><a href="userpage.php" class="link1">Homepage</a></td>
                <td><a href="RegStuds.php" class="link1">Database</a></td>

                <td><a href="#" class="link1">About</a></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
        </table></td>
    </tr>



    <tr>


        <td valign="top" class="bg6">&nbsp;</td>
    </tr>
    <tr>

        <td><table width="780" border="0" cellspacing="0" cellpadding="0">
                <tr valign="top">
                    <td width="20">&nbsp;</td>
                    <td width="297"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>

                                <td><img src="images/spacer.gif" alt="" width="30" height="30" /></td>
                        </tr>


                            </tr>
                            <tr>
                                <td class="text2">

 </div>



   <div id="max">

<?php

//some php code in here showing a mysql table.

?>

</div>

我的代码出了什么问题? php脚本是否依赖于我放置div标签的那个? 我该怎么办?所有我想在打印时显示在我的页面中的是mysql表。我正在使用 Universal Document Converter来模拟打印。

1 个答案:

答案 0 :(得分:1)

该代码段中的HTML已损坏且整个文档都包含在#tae中,因此不会打印任何内容,因为所有内容都显示在display:none;

这是该标记的清理版本。

<div id="tae">
    <table border="0" align="center" cellpadding="0" cellspacing="0" class="bg1">
        <tr>
            <td class="text1" style="height: 50px;">xd627 information management system</td>
        </tr>
        <tr>
            <td class="bg5">
                <table border="0" cellspacing="0" cellpadding="0" style="height: 62px; padding-top: 15px;">
                    <tr align="center">
                        <td><a href="userpage.php" class="link1">Homepage</a></td>
                        <td><a href="RegStuds.php" class="link1">Database</a></td>
                        <td><a href="#" class="link1">About</a></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td valign="top" class="bg6">&nbsp;</td>
        </tr>
        <tr>
            <td>
                <table width="780" border="0" cellspacing="0" cellpadding="0">
                    <tr valign="top">
                        <td width="20">&nbsp;</td>
                        <td width="297">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td>
                                        <img src="images/spacer.gif" alt="" width="30" height="30" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text2"></td>
                                </tr>
                                <!-- All this is missing, from here... -->
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
<!-- ...to here. -->


<div id="max">

<?php

//some php code in here showing a mysql table.

?>

</div>