• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Linebreak in HTML/CSS within a table

 
srilatha malip
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am just wondering whether we can give the line break(force the text to print in next line) within a column of a table if the text exceed the size of the column. I am using HTML and cascading style sheets.
Thanks in advance,
Srilatha.
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srilatha
Sure! You can put in either a <br> or a <p> in yoiur table and the text will go to the next line.
Or if you set the width of the table cells the text will wrap automatically but you wont have any control over where it breaks each line - sometimes it'll be in the middle of a word.
hope that helps

------------------
Dave
Sun Certified Programmer for the Java� 2 Platform
 
srilatha malip
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I use <br> <p> the text after these tags will be printed in next line. But, in my case I'll have some text. I'll print that text in some column. So, in between whenever, it exceeds the size of the column, it should print in the next line of the same column. My column is of fixed length.
Thanks,
Srilatha.

Sure! You can put in either a <br> or a <p> in yoiur table and the text will go to the next line.
Or if you set the width of the table cells the text will wrap automatically but you wont have any control over where it breaks each line - sometimes it'll be in the middle of a word.
 
srilatha malip
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am pasting the code, for easy understanding.
<TABLE ID="ModDetailDataTable" CLASS=lowerTableFormat cellpadding=0 cellspacing=0>
<TR><TD NOWRAP CLASS=label></TD><TD NOWRAP CLASS=data></TD><TD CLASS=data></TD></TR>
<TR><TD NOWRAP CLASS=label></TD><TD NOWRAP CLASS=dataBG></TD><TD CLASS=dataBG></TD></TR>
<TR><TD NOWRAP CLASS=label></TD><TD NOWRAP CLASS=data></TD><TD CLASS=data></TD></TR>
<TR><TD NOWRAP CLASS=label></TD><TD NOWRAP CLASS=dataBG></TD><TD CLASS=dataBG></TD></TR>
<TR><TD NOWRAP CLASS=label></TD><TD NOWRAP CLASS=data></TD><TD CLASS=data></TD></TR>
<TR><TD NOWRAP CLASS=label></TD><TD NOWRAP CLASS=dataBG></TD><TD CLASS=dataBG></TD></TR>
<TR><TD NOWRAP CLASS=label></TD><TD NOWRAP CLASS=data></TD><TD CLASS=data></TD></TR>
<TR><TD NOWRAP CLASS=label></TD><TD NOWRAP CLASS=dataBG></TD><TD CLASS=dataBG></TD></TR>
<TR><TD NOWRAP CLASS=label></TD><TD NOWRAP CLASS=data></TD><TD CLASS=data></TD></TR>
<TR><TD NOWRAP CLASS=label></TD><TD NOWRAP CLASS=dataBG></TD><TD CLASS=dataBG></TD></TR>
</TABLE>

and dataBG and data are defined in CSS as below
.data
{
HEIGHT:14px;
WIDTH:200px;
FONT-SIZE: 10pt;
FONT-WEIGHT:normal;
COLOR: #000000;
VERTICAL-ALIGN: middle;
LINE-HEIGHT: 14px;
PADDING-LEFT:4px;
}
.dataBG
{
HEIGHT:14px;
WIDTH:200px;
FONT-SIZE: 10pt;
FONT-WEIGHT:normal;
COLOR: #000000;
VERTICAL-ALIGN: middle;
LINE-HEIGHT: 14px;
PADDING-LEFT:4px;
BACKGROUND-COLOR:#ACBBE6;
DISPLAY: inline;

}
 
srilatha malip
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, Please advise me. Second and third columns may contain the text size more than the column size. It should print text in next line when it exceeds the column size.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic