I am going my first steps with html
stylesheets
.
I have this style section:
td.pel {
background-color:red;align:center;
width:100%
}
td.d1 {
background-color:#D3D3D3; text-align:center;
vertical-align:middle;
}
td.d2 {
background-color:#BDBDBD;
text-align:center;
vertical-align:middle;
}
table.pet {
text-align:center;
vertical-align:middle;font-weight:bold;color:white;
}
pel
and pet
are displayed correctly.
d1
and d2
shows the column values in center mode and with the correct vertical alignment but not with the background-color
that I have defined.
This is the html:
<table>
<tr>
<td class='d1'>
MAY
<br />
AB
</td>
<td class='d2'>
MDHR
<br />
AN
</td>
<td class='d1'>
MDHR
<br />
AB
</td>
<td class='d2'>
MHSB
<br />
AN
</td>
</tr>
<tr>
<td class='pel'>
b1i
</td>
<td class='pel'>
33mk
</td>
<td class='pel'>
12dsd
</td>
<td class='pel'>
4sa
</td>
</tr>
</table>
<table class="pet">
<tr>
<td>FEED</td>
</tr>
</table>
This html is added to a JTextPane to display the result in a JFrame:
JTextPane textPane = new JTextPane();
textPane.setContentType("text/html");
textPane.setEditable(false);
textPane.setText(lHtml);
Do you see the problem?