gpt4 book ai didi

html - Div 和表格宽度不会保持其原始形式,并且会超出行

转载 作者:太空宇宙 更新时间:2023-11-04 14:29:02 25 4
gpt4 key购买 nike

我使用 XSLT 和 XML 创建了一个 html,并用 java 对其进行了转换,我的问题是:我已经创建了一些要填充的字段,但是如果我插入的文本多于框的大小,它将在长度而不是高度上增长,我不希望它在宽度上增长,我希望它完全符合我的设置。

Here is the code :
......
<xsl:template name="bodyGEO">
<table width="770" cellspacing="0" cellpadding="0" border="0" >
<tr height="10"><td/></tr>
<tr>
<td valign="center" width="770" colspan="2">
<table width="770" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="385">
<b>
<xsl:variable name="id" select="//Product/Content/Resource/Data/TextElement[@clientCode='cme_cmb_geo_tit_1']/@elementId "/>
<xsl:variable name="max_word_count" select="//Product/Content/Resource/Data/TextElement[@clientCode='cme_cmb_geo_tit_1']/@max_word_count"/>
<DIV id="webedit" formid="{$id}" max_word_count="{$max_word_count}" comment="Title" width="385" style="background-color:#bfbfbf; max-width:385;">
<xsl:value-of disable-output-escaping="yes" select="//Product/Content/Resource/Data/TextElement[@clientCode='cme_cmb_geo_tit_1']"/>
</DIV>
</b>
</td>
<!-- <xsl:if test="$StyleSheet!='webedit'">
<td style="text-align:left;" width="10" align="left"> <b>- </b></td>
</xsl:if>-->
<td width="385">
<xsl:variable name="id" select="//Product/Content/Resource/Data/TextElement[@clientCode='cme_cmb_geo_sub_1']/@elementId "/>
<xsl:variable name="max_word_count" select="//Product/Content/Resource/Data/TextElement[@clientCode='cme_cmb_geo_sub_1']/@max_word_count"/>
<DIV id="webedit" formid="{$id}" max_word_count="{$max_word_count}" comment="SubTitle" width="385" style="background-color:#bfbfbf; align:left;">
<xsl:value-of disable-output-escaping="yes" select="//Product/Content/Resource/Data/TextElement[@clientCode='cme_cmb_geo_sub_1']"/>
</DIV>
</td>
</tr>
</table>
</td>
</tr>
.......

我尝试设置最大宽度,但它不接受...是另一种方式还是这有什么问题?谢谢。

最佳答案

您可以尝试在 table 元素上使用 table-layout 样式。

https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout

table-layout: fixed;

Fixed: Table and column widths are set by the widths of table and col elements or by the width of the first row of cells. Cells in subsequent rows do not affect column widths.

Under the "fixed" layout method, the entire table can be rendered once the first table row has been downloaded and analyzed. This can speed up rendering time over the "automatic" layout method, but subsequent cell content may not fit in the column widths provided. Any cell that has content that overflows uses the overflow property to determine whether to clip the overflow content.

同样来自 http://www.w3schools.com/cssref/pr_tab_table-layout.asp :

Fixed: "The horizontal layout only depends on the table's width and the width of the columns, not the contents of the cells"

关于html - Div 和表格宽度不会保持其原始形式,并且会超出行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19319479/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com