Currently, I am dynamically generating divs and I am searching for a solution that aligns with my specific requirements. What I need is to have the text aligned to the right without using any external styles or CSS since they are not recognized when the content is generated dynamically after the page has loaded. It is puzzling to me why my text-align:right command is being ignored by the browser. Additionally, it is important for me to maintain the use of 'h' and 'span' tags instead of 'p'. As I intend to have the 'h' element on the left and the 'span' on the right, both sharing the same baseline:
<!DOCTYPE html>
<body>
<div style="background-color:green;color:white;">
<h1 style="display:inline">Green, color of hope</h1>
<span style="text-align:right">I hope to display this to the right</span>
</div>
</body>
</html>