This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Linebreak in HTML/CSS within a table

 
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.
 
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.
 
Happily living in the valley of the dried frogs with a few tiny ads.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic