I have an HTML document that will be printed. It's an SDOCS template that grabs Salesforce record details and merges them into the document.
The page starts with some text in a div and then is followed by a html table. The table is varying lengths - it depends on which Salesforce record it is based upon.
When the table is short, the document displays properly. But, when the table is long, it bumps to the next page. I don't want it to do that, I would like it to follow immediately after the inital text, regardless of its length.
This is what I want to see:
Screenshot - What I want to see
But here is what I'm getting right now:
Screenshot - What I'm seeing
In the second screenshot, the table starts on the next page.
I've tried leveraging the css page-break-inside: avoid but it hasn't helped. Below is the HTML of my template:
<style type="text/css">.page {
width: 8.5in;
height: 11in;
}
div {
page-break-before: avoid;
}
.targetSupportTable td th {
padding:5px;
}
.wrapper {
padding: 0in;
color: #1a1a1a;
}
.bg {
position: absolute;
}
.bg img {
width: 99.5%;
}
.addressBlock{
position:absolute;
text-transform: uppercase;
padding-left:1.25in;
padding-top:9.4in;
font-size:14px;
font-family: Arial Unicode MS, sans-serif;
max-width: 3in;
/*overflow-wrap: break-word;
hyphens: auto;*/
}
.targetSupport {
background-color: #E5E5E5;
text-align: left;
width: 4in;
margin-left: 3in;
margin-top: 0in;
padding: 5px;
position: absolute;
font-family: Arial Unicode MS, sans-serif;
font-size: 15px;
}
.tartgetSupportTable {
border-collapse: collapse;
}
.statementBlock {
text-align: left;
width: 4.5in;
margin-left: 3in;
margin-top: 0in;
position: absolute;
font-family: Arial Unicode MS, sans-serif;
font-size: 15px;
}
.totalDonations {
text-align: left;
width: 2in;
margin-left: 0in;
margin-top: 0in;
position: absolute;
font-family: Arial Unicode MS, sans-serif;
font-size: 15px;
font-weight:bold;
}
.maaHeader {
text-align: left;
width: 8.5in;
font-family: Arial Unicode MS, sans-serif;
font-size: 22px !important;
border-bottom: 1px solid !important;
}
.transactions {
text-align: left;
width: 8.5in;
margin-left: 0in;
margin-top: 1in;
position: absolute;
font-family: Arial Unicode MS, sans-serif;
font-size: 12px;
}
.email {
position:absolute;
padding-left:5.4in;
padding-top:9.02in;
font-size:12px
}
.letter {
padding-left: 1in;
padding-top: 2in;
padding-right: 1in;
position: absolute;
font-size: 14px;
}
.table214 td {vertical-align: top !important;}
.table214col4 {text-align:right!important}
.table224col4 {text-align:right!important}
.table214 tr > td {
padding-bottom: 1em;
}
.table214 tr > th {
font-weight: 900 !important;
}
table.table214 {
border-collapse:collapse;
border-spacing:0px;
font-family:Arial Unicode MS,sans-serif;
font-size:10pt;
width:100%;
}
table.table224 {
border-collapse:collapse;
border-spacing:0px;
font-family:Arial Unicode MS,sans-serif;
font-size:10pt;
width:100%;
}
.table214col5{text-align:right;}
.table224col5{text-align:right;}
.table214header {
text-align:left;
font-weight: 900 !important;
color:#000000;
font-size:10px;
padding-bottom: 5px;
}
.table214footer {
text-align:right;
font-weight:bold;
height: 30px}
.openingBalance {
width: 7.5in;
text-align:right;
}
.exchangeRate {
width: 7.5in;
text-align:center;
}
</style>
<!--{{!<LineItemsSOQL>
<class>none</class>
<queryname>closingBalance</queryname>
<soql>
SELECT sum(amount__c) FROM Transactionv2__c WHERE ecaRecipient__c = '{{!eca__c.id}}' AND transactionDate__c >= {{!ECA__c.firstDayOfStatementYear__c}} AND transactiondate__c <= {{!eca__c.statementtodate__c}}
</soql>
</LineItemsSOQL>}}--><!--{{!<LineItemsSOQL>
<class>none</class>
<queryname>donationTotal</queryname>
<soql>
SELECT sum(amount__c) FROM Transactionv2__c WHERE ecaRecipient__r.account_no_string__c = '{{!eca__c.account_no_string__c}}' AND transactiondate__c >= {{!eca__c.statementfromdate__c}} AND transactionDate__c <= {{!eca__c.statementtodate__c}} AND (Donor__c != null OR (intermissionSharing__c = true AND amount__c > 0))
</soql>
</LineItemsSOQL>}}--><!--{{!<LineItemsSOQL>
<class>none</class>
<queryname>personalTransCount</queryname>
<soql>
SELECT count(id) FROM Transactionv2__c WHERE ecaRecipient__c = '{{!eca__c.id}}' AND Restriction__c = 'Pers_Reg' AND transactionDate__c >= {{!eca__c.statementfromdate__c}} AND transactiondate__c <= {{!eca__c.statementtodate__c}}
</soql>
</LineItemsSOQL>}}--><!--{{!<LineItemsSOQL>
<class>none</class>
<queryname>personalOpeningBalance</queryname>
<soql>
SELECT sum(amount__c) FROM Transactionv2__c WHERE ecaRecipient__c = '{{!eca__c.id}}' AND Restriction__c = 'Pers_Reg' AND transactionDate__c >= {{!ECA__c.firstDayOfStatementYear__c}} AND transactiondate__c < {{!eca__c.statementfromdate__c}}
</soql>
</LineItemsSOQL>}}--><!--{{!<LineItemsSOQL>
<class>none</class>
<queryname>personalClosingBalance</queryname>
<soql>
SELECT sum(amount__c) FROM Transactionv2__c WHERE ecaRecipient__c = '{{!eca__c.id}}' AND Restriction__c = 'Pers_Reg' AND transactionDate__c >= {{!ECA__c.firstDayOfStatementYear__c}} AND transactiondate__c <= {{!eca__c.statementtodate__c}}
</soql>
</LineItemsSOQL>}}-->
<div class="page">
<div class="wrapper">
<div class="statementBlock"><!--RENDER='{{!eca__c.recipient_type__c}}'!= 'MEMB' --><span style="font-size:22;">{{!eca__c.name}}</span><br />
<!--ENDRENDER--> <strong>Statement period</strong>: {{!eca__c.statementfromdate__c MMMMM yyyy}}<br />
<strong>Account number</strong>: {{!eca__c.account_no_string__c}}<br />
<!--RENDER='{{!eca__c.recipient_type__c}}'== 'MEMB' --> <strong>Average support level</strong>: ${{!eca__c.averagemonthlysupport__c #,###}}<!--ENDRENDER--></div>
</div>
<!--RENDER='{{!eca__c.recipient_type__c}}'== 'MEMB' -->
<div class="totalDonations">Total Donations:<br />
<span style="font-size:20px">${{!donationTotal.expr0 #,###.##}}</span></div>
<!--ENDRENDER--><!--RENDER='{{!eca__c.recipient_type__c}}'!= 'MEMB' -->
<div class="totalDonations">Balance:<br />
<span style="font-size:20px">${{!closingBalance.expr0 #,###.##}}</span></div>
<!--ENDRENDER-->
<div class="transactions"><!-- START MINISTRY REGULAR SECTION --><!--RENDER=('{{!ministryClosingBalance.expr0}}'!= null || ('{{!ministryTransCount.expr0}}' != null && '{{!ministryTransCount.expr0}}'!= 0 ))-->
<div class="Min_Reg">
<div class="maaHeader">Ministry Regular Fund Activity</div>
<div class="openingBalance"><!--RENDER1='{{!eca__c.statementfromdate__c}}'!= '{{!eca__c.firstdayofstatementyear__c}}' -->Opening balance: ${{!ministryOpeningBalance.expr0 #,###.##}} <!--ENDRENDER1--></div>
<!-- ******************** START RELATED LIST SECTION UNIQUEID:214********************-->
<table class="table214" style="width: 671px; page-break-inside: avoid !important; page-break-before: auto !important;">
<tbody>
<tr>
</tr>
<tr>
<th class="table214header" style="width: 10%;">date</th>
<th class="table214header" style="width: 30%;">description</th>
<th class="table214header" style="width: 30%;">comment</th>
<th class="table214header" style="width: 10%;">mode</th>
<th class="table214header" style="width: 10%;">USD</th>
<th class="table214header" style="width: 10%;">amount</th>
</tr>
</tbody>
<tbody style="page-break-inside: avoid !important; page-break-before: auto !important;"><!--{{!
<lineitemsSOQL><class>table214</class>
<listname>feeds</listname>
<soql>
SELECT transactiondate__c, descriptionForPdfStatements__c, Memo2__c,donationMode__c, USD__c, Amount__c FROM Transactionv2__c WHERE ecaRecipient__r.id = '{{!eca__c.id}}' AND transactiondate__c >= {{!eca__c.statementfromdate__c}} AND transactionDate__c <= {{!eca__c.statementtodate__c}} AND restriction__c = 'Min_Reg' order by transactionDate__c asc</soql>
<column format-date="MMM d">transactiondate__c</column>
<column type="rtf">descriptionForPdfStatements__c</column>
<column>memo2__c</column>
<column>donationMode__c</column>
<column>USD__c</column>
<column>amount__c</column>
</lineitemsSOQL>
}}-->
</tbody>
</table>
<div class="openingBalance" style="border-bottom: 1px solid !important;">Closing balance: ${{!ministryClosingBalance.expr0 #,###.##}}</div>
<br />
<!-- ******************** END RELATED LIST SECTION UNIQUEID:214********************--></div>
<!--ENDRENDER-->
<!-- START PERSONAL REGULAR SECTION2 --><!--RENDER=('{{!personalClosingBalance.expr0}}'!= null || ('{{!personalTransCount.expr0}}' != null && '{{!personalTransCount.expr0}}'!= 0 ))-->
<div class="Min_Reg">
<div class="maaHeader">Personal Regular Fund Activity</div>
<div class="openingBalance"><!--RENDER1='{{!eca__c.statementfromdate__c}}'!= '{{!eca__c.firstdayofstatementyear__c}}' -->Opening balance: ${{!personalOpeningBalance.expr0 #,###.##}} <!--ENDRENDER1--></div>
<!-- ******************** START RELATED LIST SECTION UNIQUEID:214********************-->
<table class="table214" style="width: 671px; page-break-inside: avoid !important; page-break-before: auto !important;">
<tbody>
<tr>
</tr>
<tr>
<th class="table214header" style="width: 10%;">date</th>
<th class="table214header" style="width: 30%;">description</th>
<th class="table214header" style="width: 30%;">comment</th>
<th class="table214header" style="width: 10%;">mode</th>
<th class="table214header" style="width: 10%;">USD</th>
<th class="table214header" style="width: 10%;">amount</th>
</tr>
</tbody>
<tbody style="page-break-inside: avoid !important; page-break-before: auto !important;">
<!--{{!
<lineitemsSOQL><class>table214</class>
<listname>feeds</listname>
<soql>
SELECT transactiondate__c, descriptionForPdfStatements__c, Memo2__c,donationMode__c, USD__c, Amount__c FROM Transactionv2__c WHERE ecaRecipient__r.id = '{{!eca__c.id}}' AND transactiondate__c >= {{!eca__c.statementfromdate__c}} AND transactionDate__c <= {{!eca__c.statementtodate__c}} AND restriction__c = 'Pers_Reg' order by transactionDate__c asc</soql>
<column format-date="MMM d">transactiondate__c</column>
<column type="rtf">descriptionForPdfStatements__c</column>
<column>memo2__c</column>
<column>donationMode__c</column>
<column>USD__c</column>
<column>amount__c</column>
</lineitemsSOQL>
}}-->
</tbody>
</table>
<div class="openingBalance" style="border-bottom: 1px solid !important;">Closing balance: ${{!personalClosingBalance.expr0 #,###.##}}</div>
<br />
<!-- ******************** END RELATED LIST SECTION UNIQUEID:214********************--></div>
<!--ENDRENDER-->
<br />
<!-- ******************** END RELATED LIST SECTION UNIQUEID:224********************-->
<div class="exchangeRate">Rates for converting USD amounts to CAD amounts on MEC claim forms:<br />
{{!eca__c.exchangeratefooter__c}}</div>
</div>
</div>
Related
I want to change th, td values-based values ..suppose align numbers to right(except s.no) and text to left.
<button type="submit" class="btn btn-raised btn-primary mr-5"
(click)="productPrintSection('productSection')">
<i class="fa fa-check-square-o"></i> Print
</button>
my Html code is bellow and these data getting dynamically ...
<div id="invoice-items-details" class="pt-2">
<div class="row">
<div class="table-responsive col-sm-12">
<table class="table">
<thead>
<tr>
<th
*ngFor="let column of productColumns">
{{column.name}}
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let list of productSource; let i=index">
<td
*ngFor="let column of productColumns">
{{ list[column['value']] }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
my print section code is
productPrintSection = function (reportSection) {
let printContents, popupWin;
printContents = document.getElementById(reportSection).innerHTML;
popupWin = window.open('', '_blank', 'top=0,left=0,height=100%,width=auto');
popupWin.document.open();
popupWin.document.write(`
<html>
<head>
<style>
body { width: 99%;}
h1 {
text-align:center;
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
label { font-weight: 400;
font-size: 13px;
padding: 2px;
margin-bottom: 5px;
}
table, td, th {
border: 1px solid silver;
}
table td {
text-align: center;
font-size: 13px;
}
table th {
font-size: 13px;
}
table {
border-collapse: collapse;
width: 98%;
}
th {
height: 26px;
}
</style>
</head>
<body onload="window.print();window.close()">${printContents}</body>
</html>`
);
popupWin.document.close();
}
my output screen
could u please suggest me how to show align of numbers to right(except s.no) and text to left.
well I could not find any css selector for selecting specific cells with numbers in them. That's why I've made a javascript function to check whether the cellmate can be converted to a number or not with !isNaN(col.innerText). Just call the styleTable function whenever you need it.
The following snippet contains an example based on the by you provided code.
var table = document.getElementById("products");
window.onload = function() {
styleTable(table)
};
function styleTable(table) {
//loop through the second row to check what kind of value they have
for (var i = 1, row; row = table.rows[i]; i++) {
//exclude the first column "S.no"
for (var j = 1, col; col = row.cells[j]; j++) {
//check if the column value is a number
if (!isNaN(col.innerText)) {
col.style.textAlign = "right";
}
}
}
}
body {
width: 99%;
}
h1 {
text-align: center;
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
label {
font-weight: 400;
font-size: 13px;
padding: 2px;
margin-bottom: 5px;
}
table,
td,
th {
border: 1px solid silver;
}
table td {
text-align: center;
font-size: 13px;
}
table th {
font-size: 13px;
}
table {
border-collapse: collapse;
width: 98%;
}
th {
height: 26px;
}
<table id="products">
<tr>
<th>S.no</th>
<th>Product Name</th>
<th>Product code</th>
<th>Purity</th>
<th>Store</th>
<th>city</th>
<th>state</th>
<th>quantity</th>
<th>weight</th>
<th>total</th>
<th>total orders</th>
</tr>
<tr>
<td>1</td>
<td>xyzzy</td>
<td>1001010</td>
<td>54.00</td>
<td>Default</td>
<td>Hyderabad</td>
<td>dashdsaf</td>
<td>10</td>
<td>2135.5000</td>
<td>239280324.09</td>
<td>12</td>
</tr>
<tr>
<td>2</td>
<td>xyzzy</td>
<td>1001010</td>
<td>54.00</td>
<td>Default</td>
<td>Hyderabad</td>
<td>adsfsdf</td>
<td>0</td>
<td>2135.5000</td>
<td>239280324.09</td>
<td>13</td>
</tr>
</table>
Hope this helps!
Edit:
Provided a more dynamic way of styling each cell accordingly.
The snippet below actually produces a table similar to what I want when it runs here, but the output RTF file shows a different table without the inside borders. How could this be?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="Generator" content="SAS Software Version 9.3, see www.sas.com">
<meta http-equiv="Content-type" content="text/html; charset=windows-1252">
<title>SAS Output</title>
<style type="text/css">
<!--
.table {
color: #000000;
font-family: 'Arial', 'Arial';
font-size: 10pt;
font-style: normal;
font-weight: normal;
border: medium double black;
}
.proctitle{
color: #000000;
font-family: Arial, 'Albany AMT', Arial;
font-size: x-small;
font-style: normal;
font-weight: bold;
}
.systemtitle{
font-family: Arial, 'Albany AMT', Arial;
font-size: large;
font-weight: 14pt;
color: black;
}
.header, .rowheader, .footer, .rowfooter{
color: black;
font-size: 10pt;
font-family: Arial, 'Albany AMT', Arial;
background-color: #ffffff;
font-weight: bold;
text-align: center;
vertical-align: middle;
padding: 10px;
}
.data{
font-size: 10pt;
font-family: Arial, 'Albany AMT', Arial;
background-color: #ffffff;
text-align: center;
vertical-align: middle;
padding: 10px;
}
.l {text-align: left }
.c {text-align: center }
.r {text-align: right }
.d {text-align: right }
.j {text-align: justify }
.t {vertical-align: top }
.m {vertical-align: middle }
.b {vertical-align: bottom }
TD, TH {vertical-align: top }
.stacked_cell{padding: 0 }
-->
</style>
<script language="javascript" type="text/javascript">
<!--
function startup(){
}
function shutdown(){
}
//-->
</script>
</head>
<body onload="startup()" onunload="shutdown()" class="body">
<script language="javascript" type="text/javascript">
<!--
var _info = navigator.userAgent
var _ie = (_info.indexOf("MSIE") > 0
&& _info.indexOf("Win") > 0
&& _info.indexOf("Windows 3.1") < 0);
var _ie64 = _info.indexOf("x64") > 0
//-->
</script>
<div class="branch">
<a name="IDX"></a>
<table class="systitleandfootercontainer" width="100%" cellspacing="1" cellpadding="1" rules="none" frame="void" border="0" summary="Page Layout">
<tr>
<td class="c systemtitle">Example Title Here</td>
</tr>
</table><br>
<div>
<div align="center">
<table class="table" cellspacing="0" cellpadding="5" rules="all" frame="box" bordercolor="#C1C1C1" summary="Procedure Print: Data Set WORK.TEST">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="l header" scope="col">CAR</th>
<th class="r header" scope="col">YEAR</th>
</tr>
</thead>
<tbody>
<tr>
<td class="l data">FORD</td>
<td class="r data">1995</td>
</tr>
<tr>
<td class="l data">HONDA</td>
<td class="r data">1998</td>
</tr>
<tr>
<td class="l data">CHEVY</td>
<td class="r data">2001</td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
</div>
</body>
</html>
However, this produces a table as such:
I'd like for it to look like:
I created the following dataset and used ODS RTF and my custom .css file (in this example, called TESTFOX) to output the table:
DATA TEST;
INPUT CAR $10. YEAR;
DATALINES;
FORD 1995
HONDA 1998
CHEVY 2001
;
RUN;
ODS RTF FILE="C:\USERS\DOCUMENTS\TEST.RTF" CSSSTYLE='C:\USERS\DOCUMENTS\TESTFOX.CSS';
PROC PRINT DATA=TEST NOOBS;
RUN;
ODS _ALL_ CLOSE;
Use the nth child selector. Css below may work depending on your html structure.
tr:first-child {
border-top: medium double black;
}
tr:first-child {
border-bottom: medium double black;
}
td:first-child {
border-left: medium double black;
}
td:last-child {
border-right: medium double black;
}
EDIT
After the original poster added some details, here is a possible way to get the inner border.
td, th {
border: thin solid black;
}
I have the following CSS problem.
I have these 2 tables (the first one represent the header and the second one contains the content):
<div>
<table border="1" class="standard-table-cls innerTable">
<thead>
<tr>
<th width="14.2%">Codice RM</th>
<th width="14.2%">Autore Firma</th>
<th width="14.2%">Data Firma</th>
<th width="14.2%">Acq Riserva</th>
<th width="14.2%">Consegna Finale</th>
<th width="14.2%">Descrizione RM</th>
<th width="14.2%">Imponibile</th>
</tr>
</thead>
</table>
</div>
<div class="overflowContainer">
<table border="1" class="standard-table-cls innerTable scrollableTable">
<tbody>
<%
int count = 0;
for (RM currentRM : salDettaglio.getRM()) {
String test = currentRM.getAcqRiserva();
String evenOrOdd;
if((count & 1) == 0) {
evenOrOdd = "even";
}
else {
evenOrOdd = "odd";
}
count++;
%>
<tr id="rmRow" class=<%=evenOrOdd %> >
<td width="14.2%"><%=currentRM.getCodiceRm()%></td>
<td width="14.2%"><%=currentRM.getAutoreFirma()%></td>
<td width="14.2%"><%=currentRM.getDataFirma()%></td>
<td width="14.2%"><%=currentRM.getAcqRiserva()%></td>
<td width="14.2%"><%=currentRM.getConsegnaFinale()%></td>
<td width="14.2%"><%=currentRM.getDescrizioneRM()%></td>
<td width="14.2%"><%=currentRM.getImponibile().toString()%></td>
</tr>
<%}%>
</tbody>
</table>
</div>
Both the tables have setted the standard-table-cls and the innerTable classes.
This is the code of the standard-table-cls class:
table.standard-table-cls {
margin: 0px 0px 0px 0px !important;
width: 100%;
border : #76818a 1px solid;
border-collapse: collapse;
text-align: center;
font: 11px Verdana, Geneva, Arial, Helvetica, sans-serif;
text-decoration:none;
color:#76818a;
table-layout: fixed;
}
And this is the code of the innerTable class (I want that a table that have the innerTable class setted have a width=70% of the total space and that it is floated on the right):
.innerTable{
width: 70%;
float: right;
}
The problem is that using the previous settings seems that don't see the CSS settings related to the .innerTable class.
The strange thing is that if I set the style inline, in this way:
<table border="1" class="standard-table-cls innerTable" style="width: 70%; float: right;">
it works.
Why? What am I missing? How can I solve this issue?
Tnx
Try this instead:
table.innerTable { }
table.standard-table-cls is more specific than .innerTable, so it overrides your style in .innerTable.
table.standard-table-cls styles are overriding you .innerTable.
For this, you should specify your styles like giving an id or using !important.
1. Using ID:
<table border="1" class="standard-table-cls" id="innerTable">
And CSS:
#innerTable{
width: 70%;
float: right;
}
2. Using !important (not the best way to do it though):
.innerTable{
width: 70% !important;
float: right !important;
}
Note: You can use other ways of specifying yours elements.
You can see how to specify your elements through this chart:
probably is a problem of specificity: "Specifics on CSS Specificity"
try:
table.standard-table-cls {
margin: 0px 0px 0px 0px;
width: 100%;
border : #76818a 1px solid;
border-collapse: collapse;
text-align: center;
font: 11px Verdana, Geneva, Arial, Helvetica, sans-serif;
text-decoration:none;
color:#76818a;
table-layout: fixed;
}
.innerTable{
width: 70% !important;
float: right !important;
}
I have a table with expand/collapse div elements in td.
When expanding in IE9, all is OK, but in Google Chrome (version 16.0.912.75 m) I get unexpected solid borders on differing spots.
It seems as if the colspan=3 tr's have something to do with this, as the solid borders appear above and under those. Also, the div width values seem to influence this: the behavior changes when choosing other values for these.
See below html. I added 4screen prints: initial view, expand row1, expand row2, expand both.
What is causing this odd behavior and how can I prevent it?
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<title>Example</title>
<style type="text/css">
table {
border: solid black 1pt;
border-collapse: collapse;
padding: 0;
border-spacing: 0;
}
th {
background: rgb(255, 255, 153);
border-style: solid;
border-color: black;
border-width: 1pt;
padding: 0cm 5pt;
color: black;
font-family: Verdana;
font-size: 10pt;
font-style: normal;
vertical-align: top;
}
td {
border-style: dotted dotted none none;
border-color: black;
border-width: 1pt;
padding: 0cm 5pt;
color: black;
font-style: normal;
font-family: Verdana;
font-size: 10pt;
vertical-align: top;
margin-bottom: 4.5pt;
margin-top: 0pt;
}
div.QUAL {
margin-left:4pt;
font-size: 90%;
}
input.buttonQUAL {
color: blue;
background: white;
border: none;
margin-left:0pt;
margin-top: 0px;
margin-bottom: 0px;
font-size: 100%;
}
div.listQUALdesc {
color: black;
background: white;
font-size: 100%;
}
</style>
<script type="text/javascript" language="javascript">
//expand and collapse functions based on id
function toggleMe(a){
var e = document.getElementById(a);
if(!e) return true;
if( e.style.display == "none")
{
e.style.display = "block"
}
else {
e.style.display = "none"
}
return true;
};
function expandByIdStart(IdStart){
var divs = document.getElementsByTagName('div');
for (var i=0; i<divs.length; i++) {
if (divs[i].id.match("^"+IdStart) == IdStart) {
divs[i].style.display = "block";
}
}
return true;
}
function collapseByIdStart(IdStart){
var divs = document.getElementsByTagName('div');
for (var i=0; i<divs.length; i++) {
if (divs[i].id.match("^"+IdStart) == IdStart) {
divs[i].style.display = "none";
}
}
return true;
}
</script>
</head>
<body>
<p/>
<table style='table-layout:fixed word-break:break-all'>
<col width="70"><col width="70"><col width="70">
<thead><tr><th>Col1</th><th>Col2</th><th>Col3</th></tr></thead>
<tbody>
<tr>
<td>
<input
type="button"
class="buttonQUAL"
onclick="toggleMe('row1'); return true;"
onMouseOver="this.style.cursor='hand'"
value="row1"/>
</td>
<td>text1
<div id="row1" class="listQUALdesc" style="width:100; display:none">
text2
</div>
</td>
<td></td>
</tr>
<tr>
<td><div class="QUAL">xxx</div></td>
<td>text3</td>
<td></td>
</tr>
<tr>
<td colspan="3">Start</td>
</tr>
<tr>
<td>
<input
type="button"
class="buttonQUAL"
onclick="toggleMe('row2'); return true;"
onMouseOver="this.style.cursor='hand'"
value="row2"/>
<div id="row2" class="QUAL" style="display:none;width:65">
text5<br/>
</div>
</td>
<td>text4</td>
<td></td>
</tr>
<tr>
<td colspan="3">End</td>
</tr>
</tbody>
</table>
</body>
</html>
See comments - adding < !doctype html > partly solves the issue
Addition
There are some issues to be found on the web that point at an error in Chrome and Safari (which use webkit) like the following: webkit-colspan-table-border-bug.
It seems that using colspan and bottom-border in combination with border-collapse: collapse leads to border display issues, just as in my example.
Hello guys I have a div above a textarea and they both are the same width, when I submit my form the div widens out. How can I maintain the same size with word wrapping? Thanks?
CSS:
div.tarea {
background-color: #DDDDD0;
font-family: arial, sans-serif;
font-size: 10pt;
margin: 0px;
width: 100%;
height: 100px;
overflow-y:auto;
border:2px grey solid;
}
HTML:
<tr>
<td colspan="4">
<c:if test="${action == 'update'}">
<%-- Preserve the indentation for this TEXTAREA in order to keep extra whitespace out of it. --%>
<div class="tarea" name="mcRemarkOld" ><c:forEach var="mcbean" items="${form.mcRemarks}">--- ${mcbean.auditable.lastModifiedBy.firstName} ${mcbean.auditable.lastModifiedBy.lastName}, <fmt:formatDate value="${mcbean.auditable.lastModifiedDate}" pattern="${date_time_pattern}" />
<br><br>${mcbean.remark}
<rbac:check operation="<%=Operation.ADMIN_UPDATE%>">
<a class="edit_activity" href="show.edit_remarks?remarkId=${mcbean.id}&type=1&hotPartId=${form.hotPartId}"><img class="edit" src="../images/icon_edit.gif" border="0" alt="Edit"/></a>
</rbac:check>
<br>
<br>
</c:forEach></div><br/>
</c:if>
<rbac:check field="<%=Field.HOT_PARTS_SOR_REMARKS%>" display="none">
<TEXTAREA tabindex="20" name="mcRemark" rows="7" cols="100" scrolling="auto" <c:if test="${not empty lock && !lock.locked && action != 'add'}">disabled="disabled"</c:if>>${form.mcRemark}</TEXTAREA>
</rbac:check>
</td>
</tr>
You can use the CSS property, word-wrap. This should work in all major browsers according to: http://www.w3schools.com/cssref/css3_pr_word-wrap.asp.
div.tarea {
background-color: #DDDDD0;
font-family: arial, sans-serif;
font-size: 10pt;
margin: 0px;
width: 100%;
height: 100px;
overflow-y:auto;
border:2px grey solid;
word-wrap:break-word;
}
div.tarea {
width: 100%;
height: 100px;
overflow: hidden;
float:left;
text-overflow: ellipsis;
}
I resolved the problem by adding:
<td width="800px" colspan="4">