'text-align' Example
<html> <body> <div id="myDiv" style="text-align:center"> Sample text, aligned center. </div> <button onclick="myDiv.style.textAlign='right';">Align Right</button> </body> </html>