为什么我的 table 和我的 tr 不一样

Why is my table not the same width as my tr

我想在我的第一个 table 中有第二个 table。 如何使第二个 table 与第一个 table 的 TR 一样宽? 为了使问题更明显,我在代码中添加了一些颜色。 请原谅我的混乱,这是我第一次尝试 HTML...

    <table width="100%" style="border-collapse: collapse;border-spacing: 0;">
    <xsl:if test="NonOriginalArticlesCount">
        <xsl:for-each select="NonOriginalArticles/Mail_NewsletterArticle">
            <tr>
                <!--column picture-->
                <td rowspan="2" style="padding-top: 1.5em; ">
                    ...
                </td>
                <!--column name and desc-->
                <td colspan="3" style="padding-top: 1.5em;">
                    ...
                </td>
                <!--column price-->
                <td>
                ...     
                </td>
            </tr>
                <!--row alternative-->  
                <tr colspan="2">
                    <xsl:attribute name="style">
                    background:black;
                    backgound-color:black;
                    color:<xsl:value-of select="/Mail_Newsletter/Color"/>;
                    padding-bottom:1.5em;
                    </xsl:attribute>
                    <td>
                        <xsl:attribute name="style">
                        background:yellow;
                        backgound-color:yellow;
                        color:<xsl:value-of select="/Mail_Newsletter/Color"/>;
                        </xsl:attribute>
                        <table width="100%">
                            <xsl:attribute name="style">
                            table-layout: fixed
                            width=100%;
                            border: 1px solid;
                            font-size:'14px';
                            border-collapse: collapse;
                            border-spacing: 0;
                            border-color: <xsl:value-of select="/Mail_Newsletter/Color"/>;
                            background:<xsl:value-of select="/Mail_Newsletter/LighterColor"/>;
                            backgound-color:<xsl:value-of select="/Mail_Newsletter/LighterColor"/>;
                            color:<xsl:value-of select="/Mail_Newsletter/Color"/>;

                            </xsl:attribute>
                            <tr>
                                <td>
                                    ...
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </tr>
        </xsl:for-each>
    </xsl:if>   
</table>

只有 td(或 th)可以是 tr 元素的子元素。将 div 替换为 td 并将内部 table 设置为 100% 宽度。

            </tr> <!-- close old table row before opening a new one -->
            <tr colspan="2">
                <xsl:attribute name="style">
                    background:black;
                    backgound-color:black;
                    color:<xsl:value-of select="/Mail_Newsletter/Color"/>;
                    padding-bottom:1.5em;
                </xsl:attribute>
                <td> <!-- replaces div -->
                    <xsl:attribute name="style">
                        background:yellow;
                        backgound-color:yellow;
                        color:<xsl:value-of select="/Mail_Newsletter/Color"/>;
                    </xsl:attribute>
                    <table width="100%">