aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Linebreak in HTML/CSS within a table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Linebreak in HTML/CSS within a table" Watch "Linebreak in HTML/CSS within a table" New topic
Author

Linebreak in HTML/CSS within a table

srilatha malip
Greenhorn

Joined: Feb 08, 2001
Posts: 21
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

Joined: May 10, 2001
Posts: 3244
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


Dave
srilatha malip
Greenhorn

Joined: Feb 08, 2001
Posts: 21
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

Joined: Feb 08, 2001
Posts: 21
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

Joined: Feb 08, 2001
Posts: 21
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Linebreak in HTML/CSS within a table