X
Tap here to go to the mobile version of the site.

Support Forum

TROUBLE WITH MAX-LENGTH

Posted

code:

td	{word-wrap:break-word; max-width:8ch;font-family:Courier New}
red	{color:red}
<table>
<tr><td>	<td>&spades;<span contenteditable="true" id='NS' spellcheck="false"></span>
	<br><red>&hearts;<span contenteditable="true" id='NH' spellcheck="false"></span></red></td></tr></table>

works fine in try-it editor, but fails in my HTML. Will upload HTML if I can

code: <pre><nowiki>td {word-wrap:break-word; max-width:8ch;font-family:Courier New} red {color:red} <table> <tr><td> <td>&spades;<span contenteditable="true" id='NS' spellcheck="false"></span> <br><red>&hearts;<span contenteditable="true" id='NH' spellcheck="false"></span></red></td></tr></table></nowiki></pre> works fine in try-it editor, but fails in my HTML. Will upload HTML if I can

Modified by cor-el

Chosen solution

Your question refers to max-length but I'm not sure how that relates to your code.

If you meant max-width and the problem is that a table cell doesn't comply with set dimensions, you need to override the default "stretch-to-fit" behavior of tables by adding this to your CSS:

table {
  table-layout: fixed;
}

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

Read this answer in context 0

Additional System Details

Installed Plug-ins

  • Shockwave Flash 31.0 r0

Application

  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0

More Information

Question owner

Will be long, but here goes:

table	{maximum-width:2.5in; border-collapse: collapse; margin:auto;
	border:1px solid black}}
td	{word-wrap:break-word; max-width:8ch;}
body	{font-family:Courier New; font-size:10pt;}
	<table>
	<colgroup><col span='3' style="width:.8in;max-width:.8in"></colgroup>
<tr>	<td class='T'>Board <span id='HB'></span>
	<br>Dealer <span id='HD'></span>
	<br>Vul <span id='HV'></span></td>
	<td>&spades;<span contenteditable="true" id='NS' spellcheck="false"></span>
	<br><red>&hearts;<span contenteditable="true" id='NH' spellcheck="false"></span>
	<br>&diams;<span contenteditable="true" id='ND' spellcheck="false"></span></red>
	<br>&clubs;<span contenteditable="true" id='NC' spellcheck="false"></span></td>
	<td></td></tr>
<tr>	<td>&spades;<span contenteditable="true" id='WS' spellcheck="false"></span>
	<br><red>&hearts;<span contenteditable="true" id='WH' spellcheck="false"></span>
	<br>&diams;<span contenteditable="true" id='WD' spellcheck="false"></span></red>
	<br>&clubs;<span contenteditable="true" id='WC' spellcheck="false"></span></td>
	<td><table style='width:100%'>
	<tr>	<td colspan='2' class='C'>N</td></tr>
	<tr>	<td class='L'>W</td>
		<td class='R'>E</td></tr>
	<tr>	<td colspan='2' class='C'>S</td></tr></table></td>
	<td>&spades;<span contenteditable="true" id='ES' spellcheck="false"></span>
	<br><red>&hearts;<span contenteditable="true" id='EH' spellcheck="false"></span>
	<br>&diams;<span contenteditable="true" id='ED' spellcheck="false"></span></red>
	<br>&clubs;<span contenteditable="true" id='EC' spellcheck="false"></span></td></tr>
<tr>	<td></td>
	<td>&spades;<span contenteditable="true" id='SS' spellcheck="false"></span>
	<br><red>&hearts;<span contenteditable="true" id='SH' spellcheck="false"></span>
	<br>&diams;<span contenteditable="true" id='SD' spellcheck="false"></span></red>
	<br>&clubs;<span contenteditable="true" id='SC' spellcheck="false"></span></td>
	<td></td></tr>
	</table>

try entering AKQJ1098765432 in field

Will be long, but here goes: <pre><nowiki>table {maximum-width:2.5in; border-collapse: collapse; margin:auto; border:1px solid black}} td {word-wrap:break-word; max-width:8ch;} body {font-family:Courier New; font-size:10pt;} <table> <colgroup><col span='3' style="width:.8in;max-width:.8in"></colgroup> <tr> <td class='T'>Board <span id='HB'></span> <br>Dealer <span id='HD'></span> <br>Vul <span id='HV'></span></td> <td>&spades;<span contenteditable="true" id='NS' spellcheck="false"></span> <br><red>&hearts;<span contenteditable="true" id='NH' spellcheck="false"></span> <br>&diams;<span contenteditable="true" id='ND' spellcheck="false"></span></red> <br>&clubs;<span contenteditable="true" id='NC' spellcheck="false"></span></td> <td></td></tr> <tr> <td>&spades;<span contenteditable="true" id='WS' spellcheck="false"></span> <br><red>&hearts;<span contenteditable="true" id='WH' spellcheck="false"></span> <br>&diams;<span contenteditable="true" id='WD' spellcheck="false"></span></red> <br>&clubs;<span contenteditable="true" id='WC' spellcheck="false"></span></td> <td><table style='width:100%'> <tr> <td colspan='2' class='C'>N</td></tr> <tr> <td class='L'>W</td> <td class='R'>E</td></tr> <tr> <td colspan='2' class='C'>S</td></tr></table></td> <td>&spades;<span contenteditable="true" id='ES' spellcheck="false"></span> <br><red>&hearts;<span contenteditable="true" id='EH' spellcheck="false"></span> <br>&diams;<span contenteditable="true" id='ED' spellcheck="false"></span></red> <br>&clubs;<span contenteditable="true" id='EC' spellcheck="false"></span></td></tr> <tr> <td></td> <td>&spades;<span contenteditable="true" id='SS' spellcheck="false"></span> <br><red>&hearts;<span contenteditable="true" id='SH' spellcheck="false"></span> <br>&diams;<span contenteditable="true" id='SD' spellcheck="false"></span></red> <br>&clubs;<span contenteditable="true" id='SC' spellcheck="false"></span></td> <td></td></tr> </table> </nowiki></pre> try entering AKQJ1098765432 in field

Modified by cor-el

TyDraniu
  • Top 25 Contributor
369 solutions 2057 answers

Try this for a table and td elements:

table { display:inline-block; max-width:2.5in; border-collapse: collapse; margin:auto;  border:1px solid black}
td {word-wrap:break-word; max-width:1in;}
Try this for a table and td elements: table { display:inline-block; max-width:2.5in; border-collapse: collapse; margin:auto; border:1px solid black} td {word-wrap:break-word; max-width:1in;}
jscher2000
  • Top 10 Contributor
8903 solutions 72815 answers

Chosen Solution

Your question refers to max-length but I'm not sure how that relates to your code.

If you meant max-width and the problem is that a table cell doesn't comply with set dimensions, you need to override the default "stretch-to-fit" behavior of tables by adding this to your CSS:

table {
  table-layout: fixed;
}

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

Your question refers to max-length but I'm not sure how that relates to your code. If you meant max-width and the problem is that a table cell doesn't comply with set dimensions, you need to override the default "stretch-to-fit" behavior of tables by adding this to your CSS: <pre>table { table-layout: fixed; } </pre> See: https://developer.mozilla.org/docs/Web/CSS/table-layout