Hi there
I'm trying to format HTML content in Swing. Formattings such as color or text-decoration are working fine. But when it comes to margin of links it is not working at all.
This is all the CSS syntax I'm using:
StyleSheet styleSheet = kit.getStyleSheet();
styleSheet.addRule("a {font : arial; text-decoration: none; color: #0174DF; margin-left: 50px}");
everything, except the margin-left
is working. I tested the syntax in a Browser and it works fine there. I also tried using text-align: left
or display: block
becouse I found some articles pointing out that margin of links would not work without.
The following HTML code is used:
<html><head></head><body><div>
<a href="http://www.zhaw.ch" style="font-size: 50.24324324324324px">akamaitechnologies.com</a>
<a href="http://www.zhaw.ch" style="font-size: 17.37837837837838px">amazonaws.com</a>
<a href="http://www.zhaw.ch" style="font-size: 18.243243243243242px">cotendo.net</a>
<a href="http://www.zhaw.ch" style="font-size: 24.08108108108108px">facebook.com</a>
<a href="http://www.zhaw.ch" style="font-size: 17.594594594594597px">google.ch</a>
<a href="http://www.zhaw.ch" style="font-size: 55.0px">heise.de</a>
<a href="http://www.zhaw.ch" style="font-size: 16.08108108108108px">ip-plus.net</a>
<a href="http://www.zhaw.ch" style="font-size: 21.054054054054056px">ligatus.com</a>
</div></body></html>
The HTML code is generated by a library and can't be modified.
From my understanding of HTML/CSS it is not possible to add margin
style information to an inline object like a link becouse margin-top or margin-bottom is not possible. margin-left oder margin-right however should not be a problem.
thx
edit: by the way, I'm using HTMLEditorKit.