I want to align text outside an element legend, but I cannot figure out how to calculate the width legend.
This example works exactly the way I want, but it uses hardcoded top and left sizes. This is interrupted as soon as the width changes legend. Is there an easy way to do this? (Latest browsers are fine. No need to support older versions):
<fieldset>
<legend style="border:3px solid red">
Legend legend legend
<span style="position:absolute; top:0; left:180px;">Aligned Text</span>
</legend>
text text text
</fieldset>
http://jsfiddle.net/JS6dP/

source
share