Please consider this bit of code:
HtmlViewer1.LoadFromString(
'<style>A.X{border-bottom: 2px solid red;}</style>'
+'<h1><a href="#x" class="X">xxx</a></h1>');
It looks like the border-bottom on the link gets drawn from incorrect coordinates, possibly (0,0):
